mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 04:54:16 +00:00
change path
This commit is contained in:
parent
d75d74b41e
commit
f66937947c
1 changed files with 3 additions and 16 deletions
|
|
@ -14,30 +14,17 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
'--pytest',
|
'--pytest',
|
||||||
dest='pattern',
|
dest='pattern',
|
||||||
action='store_const',
|
action='store_const',
|
||||||
const=r'tests_*\.py',
|
const=r'.*/tests_*\.py',
|
||||||
default=r'tests_*\.py',
|
default=r'.*/tests_*\.py',
|
||||||
help='(the default) ensure tests match %(const)s',
|
help='(the default) ensure tests match %(const)s',
|
||||||
)
|
)
|
||||||
mutex.add_argument(
|
|
||||||
'--pytest-test-first',
|
|
||||||
dest='pattern',
|
|
||||||
action='store_const',
|
|
||||||
const=r'test_.*\.py',
|
|
||||||
help='ensure tests match %(const)s',
|
|
||||||
)
|
|
||||||
mutex.add_argument(
|
|
||||||
'--django', '--unittest',
|
|
||||||
dest='pattern',
|
|
||||||
action='store_const',
|
|
||||||
const=r'test.*\.py',
|
|
||||||
help='ensure tests match %(const)s',
|
|
||||||
)
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
retcode = 0
|
retcode = 0
|
||||||
reg = re.compile(args.pattern)
|
reg = re.compile(args.pattern)
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
base = os.path.basename(filename)
|
base = os.path.basename(filename)
|
||||||
|
print(base)
|
||||||
if (
|
if (
|
||||||
not reg.fullmatch(base) and
|
not reg.fullmatch(base) and
|
||||||
not base == '__init__.py' and
|
not base == '__init__.py' and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue