0

I have a few pytest files (begins with "test_"), each one of them tests another part of the system Now I want to create one file which supposes to run all the tests together. I read here how to run one python file from another, but it's a bit different when the file is pytest file because I run it with special flags.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • If you followed the naming conventions, `pytest` will discover all tests on its own. Just run it from the project root. – Klaus D. Sep 19 '21 at 12:45
  • Can you please be more specific? I didn't fully understand what you wrote @KlausD. – Dana Troushinsky Sep 19 '21 at 12:46
  • Run `pytest` in the root folder of your project! – Klaus D. Sep 19 '21 at 12:50
  • I will try that, thank you – Dana Troushinsky Sep 19 '21 at 12:52
  • Can you tell me how to do it via terminal command? – Dana Troushinsky Sep 19 '21 at 13:43
  • See also https://stackoverflow.com/questions/6397063 . The issue is pytest was designed to collect your test and execute them depending on the configuration file or command line arguments. Having one test function that calls others is essentially wrong, because test functions should always be atomic. Each test function should be implemented in a way that only calls the code you are testing, not other test functions. – bad_coder Sep 19 '21 at 14:02

0 Answers0