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 (#29)

* fix: prevent argparse from eating up abbreviated args that should be passed to the runner

* build: fixing with `ruff check .`

* build: formatting update.
  • Loading branch information
radoshi authored Mar 25, 2024
1 parent 1d47e30 commit dc12a5a
Show file tree
Hide file tree
Showing 2 changed files with 7 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
8 changes: 6 additions & 2 deletions tests/test_parse_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,15 @@ 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 dc12a5a

Please sign in to comment.