1 year ago

#327799

test-img

Ben

How to run pytest file by file in no particular order

I am testing a backend of Flask and MongoDB but run into a problem when running the total test suite. If I run certain files in the test suite independently, they work fine. I wrote a script which runs each file alone but this gives me problems since the coverage report only takes the last test.

Is there a way to run each file independently with one command? Or is there a way to aggregate all the tests into one coverage report?

Unfortunately I am not able to share the code but will give as much information as I can. Thank you very much for any help.

Addition When running the tests from the top level, it initiates with the line

**collecting ... ** Testing database connected Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=False), 'TESTS')

This line is not present when running the file individually.

python

flask

pytest

coverage.py

0 Answers

Your Answer

Accepted video resources