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
JavaScript
x
2
1
ERROR: InvocationError: could not find executable
2
Advertisement
Answer
As written by jason meridth:
JavaScript
1
2
1
$ tox -e py35 -- project/tests/test_file.py::TestClassName::test_method
2
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:
JavaScript
1
12
12
1
[tox]
2
envlist = py35
3
4
[testenv]
5
deps =
6
pytest
7
pytest-cov
8
pytest-pep8
9
commands =
10
pip install -e .
11
pytest {posargs}
12
Run one test with unittest
JavaScript
1
2
1
python3 -m unittest -q test_file.TestClassName
2