vendredi 10 mai 2019

Pytest only collects tests when test file name is specified

I have a test in a file called sqs_tests.py, in a new project.

def test_stuff():
    assert True

When I enter "pytest" in the command line, pytest runs but it collects 0 tests.

When I enter "pytest sqs_tests.py", it collects the one test and the test passes.

Both commands are run from the same directory, /tests/backend/sqs

Why doesn't running "pytest" collect the test?

---What I've tried---

It doesn't appear to be an issue with my IDE (PyCharm) because the same issue occurs when I run from Mac Terminal.

It doesn't appear to be an issue with my file/function names, and it doesn't matter whether the function is in an appropriately named class or not.

I also created a pytest.ini file and checked that the test/class/file formats are consistent with Pytest discovery.

I'm running Python 3.7.2 with Pytest 4.4.2 on Mojave.

Aucun commentaire:

Enregistrer un commentaire