JRG
JRG

Reputation: 210

In Pytest, how can I view the names of my tests as they are running?

I started out using the test framework that comes with Python3. Later I changed to Pytest.

I expected that

Pytest my_file.py

would output the name of the currently running test, like the test framework that comes with python3 does, but it doesn't.

Is there an option that enables this?

Upvotes: 0

Views: 193

Answers (1)

blubberdiblub
blubberdiblub

Reputation: 4135

Try the -v option, a.k.a. --verbose:

pytest -v your_file.py

And you can get a list of all possible options:

pytest --help

Also, ideally, your project would be structured in such a way that you don't need to call pytest with an explicit script file as argument. I. e. test suites would be in separate script files with names of test_XYZ.py, living either in the project's main directory or in a subdirectory called tests, as recommended by Kenneth Reitz. So you would just have to do:

pytest -v

Upvotes: 2

Related Questions