Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run only one test in tox?

Tags:

python

tox

I'm trying to write a new test for a project and I'd like to test only that one test in tox. I'm already completely sure that other tests are fine, I don't need them being run every time. The only suggestion I've found doesn't work with

ERROR: InvocationError: could not find executable 
like image 221
int_ua Avatar asked Feb 29 '16 10:02

int_ua


2 Answers

As written by jason meridth:

$ tox -e py35 -- project/tests/test_file.py::TestClassName::test_method

But the fine grain is mentioned by beluga.me in the comments: If you have a tox.ini file you might need to add the {posargs} to pytest in tox.ini:

[tox]
envlist = py35

[testenv]
deps =
    pytest
    pytest-cov
    pytest-pep8
commands =
    pip install -e .
    pytest {posargs}

Run one test with unittest

python3 -m unittest -q test_file.TestClassName
like image 94
Martin Thoma Avatar answered Oct 16 '22 21:10

Martin Thoma


Run this command:

tox -epy27 -- test_name

for more information.

like image 9
Yael Avatar answered Oct 16 '22 22:10

Yael