-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hello,
I configure pytest-watcher in our pyproject.toml file like so:
[tool.pytest-watcher]
now = true
clear = true
delay = 0.2
runner = "pytest"
runner_args = ["-n0"]
patterns = ["*.py"]
ignore_patterns = []Note the runner_args.
When I invoke ptw . this works as desired and pytest-xdist is completely disabled, i.e. --numprocesses=0 or -n0 is honored.
However, when I then try to run a specific test and only that test, as follows, it seems like runner_args are not merged but rather are overwritten completely:
ptw . documents/tests/test_api.py::test_foo
(.venv) C:\Users\mcampbell\codes\atom\atom>ptw . documents\tests\test_document_models.py::test_revision_cannot_be_empty
pytest-watcher version 0.4.3
Runner command: pytest
Waiting for file changes in C:\Users\mcampbell\codes\atom\atom
============================================================================== test session starts ==============================================================================
platform win32 -- Python 3.11.9, pytest-8.2.1, pluggy-1.5.0
django: version: 4.2.13, settings: atom.settings_local (from env)
rootdir: C:\Users\mcampbell\codes\atom\atom
configfile: pyproject.toml
plugins: django-test-migrations-1.4.0, cov-5.0.0, django-4.10.0, xdist-3.6.1
collecting: 1/22 workers
The line collecting: 1/22 workers indicates that the -n0 flag is no longer being passed to pytest.
This seems like a bug as pytest generally takes the approach of merging configuration parameters from the various sources (pyproject.toml, CLI flags, etc.). In the event that I have pytest configuration in pytest.ini or pyproject.toml, but I invoke pytest --foo=bar, it does not honor the foo flag and throw away the other configuration parameters set in the config file.