[TIP] PyTest + Tox: Ignoring tests based on command line options.

Daniel Knüttel daniel.knuettel at daknuett.eu
Thu Nov 21 08:57:57 PST 2019


Hi, Folks.

Basically what I have is a big bunch of small tests that I want to 
run all the time. Those are pretty fast & handwritten to test specific
features. I also have some random tests that take a long time to run
(2000 10-qbit circuits of length 100 for instance).

I need those tests to ensure my library works as intended, but I dont
want to wait a minute for my tests to run when I am just testing one
feature. 

So I marked my slow tests with @pytest.mark.slow and added 
'-m "not slow"' in my tox.ini. Which works fine unless I do want to run
the tests, in which case I would have to rewrite my tox.ini.

Is there a way to run the tests if I pass some argument to tox?
like 'tox -m "with slow"'?
 
Cheers,
Daniel
-- 
Daniel Knüttel <daniel.knuettel at daknuett.eu>




More information about the testing-in-python mailing list