Option for py.test to ignore setup.cfg file?

I have a file setup.cfgthat sets the default options for pytest. Although this is great for running tests for my entire package, I would like to ignore the parameters setup.cfgwhen running tests for individual modules. Is there any easy way to do this? I do not see anything in the help pytestto ignore the file setup.cfg.

+4
source share
3 answers

This is not ideal, but at the moment I decided to create runtests.py, which colleagues can use to run tests, following the suggestion in pytest docs . It loses some of the features that I wanted to keep in setup.cfg(but then can also be turned off when I do more focused testing), but at least it gives me something that others can use to easily run tests.

+1
source

You can also create an empty file pytest.iniin the current directory.

The configuration file discovery function will try to find the file matching that name before searching setup.cfg.

+1
source

, , , option=value:

# long opt
pytest tests/test_mystuff.py::test_something --override-ini="log_level=10"

# short opt
pytest tests/test_mystuff.py::test_something -o log_level=10

.

0

Source: https://habr.com/ru/post/1606306/


All Articles