Skip to content

Commit 5df1a4b

Browse files
authored
Merge pull request #429 from rrauenza/rrauenza-patch-1
fix regular expression for test files
2 parents 8a36145 + 3724c8f commit 5df1a4b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pre_commit_hooks/tests_should_end_in_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
1818
args = parser.parse_args(argv)
1919

2020
retcode = 0
21-
test_name_pattern = 'test.*.py' if args.django else '.*_test.py'
21+
test_name_pattern = r'test.*\.py' if args.django else r'.*_test\.py'
2222
for filename in args.filenames:
2323
base = os.path.basename(filename)
2424
if (

tests/tests_should_end_in_test_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def test_main_one_fails():
1111
assert ret == 1
1212

1313

14+
def test_regex():
15+
assert main(('foo_test_py',)) == 1
16+
17+
1418
def test_main_django_all_pass():
1519
ret = main((
1620
'--django', 'tests.py', 'test_foo.py', 'test_bar.py',

0 commit comments

Comments
 (0)