mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 03:56:54 +00:00
add exclude pattern to test names hook
This commit is contained in:
parent
634383cffd
commit
a977384397
3 changed files with 22 additions and 0 deletions
|
|
@ -15,6 +15,11 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
|||
'--django', default=False, action='store_true',
|
||||
help='Use Django-style test naming pattern (test*.py)',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--exclude', default='facto.*.py',
|
||||
help='Use to exclude a certain pattern from check default to factory (fact*.py)',
|
||||
)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
retcode = 0
|
||||
|
|
@ -23,6 +28,7 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
|||
base = os.path.basename(filename)
|
||||
if (
|
||||
not re.match(test_name_pattern, base) and
|
||||
not re.match(args.exclude, base) and
|
||||
not base == '__init__.py' and
|
||||
not base == 'conftest.py'
|
||||
):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue