mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Merge pull request #429 from rrauenza/rrauenza-patch-1
fix regular expression for test files
This commit is contained in:
commit
5df1a4bf6f
2 changed files with 5 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
retcode = 0
|
retcode = 0
|
||||||
test_name_pattern = 'test.*.py' if args.django else '.*_test.py'
|
test_name_pattern = r'test.*\.py' if args.django else r'.*_test\.py'
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
base = os.path.basename(filename)
|
base = os.path.basename(filename)
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ def test_main_one_fails():
|
||||||
assert ret == 1
|
assert ret == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_regex():
|
||||||
|
assert main(('foo_test_py',)) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_main_django_all_pass():
|
def test_main_django_all_pass():
|
||||||
ret = main((
|
ret = main((
|
||||||
'--django', 'tests.py', 'test_foo.py', 'test_bar.py',
|
'--django', 'tests.py', 'test_foo.py', 'test_bar.py',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue