I create a simple new project with a new virtualenv. requirements.txt just has pytest and that's it.
. ├── requirements.txt └── tests ├── __init__.py └── sample_tests.py sample_tests.py:
import pytest @pytest.mark.unit def test_a(): assert 1 + 1 == 2 If I run pytest with the python test file name, it works fine:
vex --path ~/.virtualenvs/pytestdemo pytest tests/sample_tests.py However, none of the following invocations work. All of them fail to see the test and output collected 0 items and no tests ran:
vex --path ~/.virtualenvs/pytestdemo pytest tests vex --path ~/.virtualenvs/pytestdemo pytest tests/ vex --path ~/.virtualenvs/pytestdemo pytest vex --path ~/.virtualenvs/pytestdemo python -m pytest tests vex --path ~/.virtualenvs/pytestdemo python -m pytest tests/ vex --path ~/.virtualenvs/pytestdemo python -m pytest In this simple scenario I just have one test file and one test, but in my real application, I have many tests, and I want a simple invocation to run all of them. I've narrowed down my scenario to this super simple isolated example and I'd like to get very basic test invocation to work.
I've poured through the docs and getting started guides. I've tried using (and not using) a custom pytest.ini. Obviously, I tried invoking by both pytest and by python -m pytest.