0

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.

6
  • Go to the top level folder and just run with pytest command. Commented Mar 24, 2022 at 5:13
  • @DevangSanghani thank you. When I do this certain tests fail and so the report doesn't seem to include them. Commented Mar 24, 2022 at 11:49
  • Then perhaps need to fix them? Commented Mar 24, 2022 at 11:57
  • Ideally failed tests should also come in the report. Commented Mar 24, 2022 at 12:12
  • @DevangSanghani yeah that's what I think too but it doesn't seem as though they are Commented Mar 25, 2022 at 10:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.