How to override pytest.ini when running tests from the command line?

I have a code base containing several python packages. There is also a pytest.ini file that contains the names of these files.

Example directory structure:

main_dir
  |
  |
  |--- package1
  |
  |--- package2
  |
  |--- pytest.ini

pytest.ini is as follows

[pytest.ini]
addopts = package1 package2

The problem is because pytest.iniI cannot run tests only with the package in mind. For example, it py.test package1\now runs tests for tests package2.

If I delete the pytest.ini file, the command works as expected. The only option I see is to maintain an uncommitted version of pytest.ini, which I am constantly changing to suit my needs.

How to override pytest.ini parameters and run tests only with the package in mind?

+4
source
1

addopts ,

, , ,

+1

All Articles