mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Improve test coverage.
This commit is contained in:
parent
b80ca9e84a
commit
8270d81308
4 changed files with 44 additions and 1 deletions
|
|
@ -2,7 +2,9 @@ import ast
|
|||
import pytest
|
||||
|
||||
from pre_commit_hooks.debug_statement_hook import DebugStatement
|
||||
from pre_commit_hooks.debug_statement_hook import debug_statement_hook
|
||||
from pre_commit_hooks.debug_statement_hook import ImportStatementParser
|
||||
from testing.util import get_resource_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -53,3 +55,13 @@ def test_returns_one_form_2(ast_with_debug_import_form_2):
|
|||
assert visitor.debug_import_statements == [
|
||||
DebugStatement('pudb', 3, 0)
|
||||
]
|
||||
|
||||
|
||||
def test_returns_one_for_failing_file():
|
||||
ret = debug_statement_hook([get_resource_path('file_with_debug.notpy')])
|
||||
assert ret == 1
|
||||
|
||||
|
||||
def test_returns_zero_for_passing_file():
|
||||
ret = debug_statement_hook([__file__])
|
||||
assert ret == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue