Skip to content

Update/review pytest.ini

The pytest.ini in the root is picked up for all pytest runs.

This configures all tests in the same way, which may or may not be desirable.

In my opinion the following options should be removed or changed:

-ra : should be removed

This option forces all tests to run regardless of their status in the previous run. This in turn blocks using --last-failed which is highly useful for local development and avoids running tests which have passed already. I suggest removing this.

For CI, this should be either added manually in the invocation, or a pytest --cache-clear can be run prior to running a test.

--basetemp=./tmp should be changed/removed

This option removes the contents of the specified directory. While important files should not be kept in ./tmp, this is also something used during development and can accidentally trigger deletion of files without the user being aware. This option was most likely added for debugging the tests themselves during development.

I suggest either changing this to ./pytest_tmp to make it explicit or removing it and using the system temporary directory. Test developers should easily be able to add this back in case it is needed for testing.

--ignore=

These seem to be arbitrary and possibly not needed. Leaving them in should not be problematic, but in an ideal world one could simply run pytest from the root to run a smoke test of all cases without ignoring certain tests.

I think the first two changes are quite important, but I welcome discussion here.

Edited by Archit Tamarapu