Are there any ways to set a path to ignore in pyproject.toml like
#pyproject.toml
[tool.pytest.ini_options]
ignore = ["path/to/test"]
instead of using addopts:
#pyproject.toml
[tool.pytest.ini_options]
addopts = "--ignore=path/to/test"
As the file extension suggests, pyproject.toml is a TOML file. It contains separate sections for different tools. Black is using the [tool.black] section. The option keys are the same as long names of options on the command line.
This allows the use of pytest in structures that are not part of a package and don’t have any particular configuration file. If no args are given, pytest collects test below the current working directory and also starts determining the rootdir from there. pytest.ini: will always match and take precedence, even if empty.
Run specific test method. To run specific test method from a specific test file, we can type. pytest test_pytestOptions.py::test_api -sv. This above will run the test method test_api () from file test_pyTestOptions.py.
If no setup.py was found, look for pytest.ini, pyproject.toml, tox.ini, and setup.cfg in each of the specified args and upwards. If one is matched, it becomes the configfile and its directory becomes the rootdir. If no configfile was found and no configuration argument is passed, use the already determined common ancestor as root directory.
Use the following in pyproject.toml
norecursedirs = [
"path/to/test/*",
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With