Skip to content

Commit

Permalink
fix: prevent argparse from eating up abbreviated args that should be …
Browse files Browse the repository at this point in the history
…passed to the runner
  • Loading branch information
radoshi committed Mar 21, 2024
1 parent 1d47e30 commit 5f332b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions pytest_watcher/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def _parse_patterns(arg: str):
Watch the <path> for file changes and trigger the test runner (pytest).\n
Additional arguments are passed directly to the test runner.
""",
allow_abbrev=False,
)
parser.add_argument("path", type=Path, help="The path to watch for file changes.")
parser.add_argument(
Expand Down
5 changes: 3 additions & 2 deletions tests/test_parse_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ def test_ignore_patterns(args: List[str], ignore_patterns: List[str]):
([".", "--lf", "--nf", "-vv"], ["--lf", "--nf", "-vv"]),
([".", "--runner", "tox", "--lf", "--nf", "-vv"], ["--lf", "--nf", "-vv"]),
([".", "--lf", "--nf", "-vv", "--runner", "tox"], ["--lf", "--nf", "-vv"]),
([".", "--ignore", "tests/test_watcher.py"], ["--ignore", "tests/test_watcher.py"]),
],
)
def test_runner_args(args: List[str], runner_args: List[str]):
_, runner_args = parse_arguments(args)
assert runner_args == runner_args
_, parsed_args = parse_arguments(args)
assert parsed_args == runner_args


def test_version(capsys: pytest.CaptureFixture):
Expand Down

0 comments on commit 5f332b9

Please sign in to comment.