1

I am trying to use pytest to run some tests. My package contains a setup.cfg file where I've stated all the pytest options

[tool:pytest] addopts = --verbose unit as it is visible I've added the unit directory to find the test files. This works fine and all the tests from the directory get executed during the normal build process.

Actual Problem -

Now I have another directory integ where I have my integration tests which I want to run sometimes but do not want them as a part of my build process. I have created another command line option to run my integ tests but I am not able to figure out how to provide the file set correctly for the same

I've tried pytest --ignore=unit integ through command line but it runs all my tests from unit as well as integ. I want to run the tests present in integ only and ignore the tests from unit. What am I missing here?

[update] When I run pytest --ignore=unit/test_file.py integ it ignores the tests in test_file but when I use pytest --ignore=unit/*.py integ it says no matches found: --ignore=test/*.py

Thanks

1 Answer 1

1

--override-ini=testpaths=test_integ solved my problem. I was able to override the options from my setup.cfg file using this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.