1

I have a test that sets the ground for a couple of other tests to run, thus, I need the first test to succeed and only then run the other ones. I know I could use pytest-dependencies but that would not allow me to run my tests in parallel. I'm also interested in the option of only having to run one test and have it initialize all the ones that depend on it if it succeeds (instead of running all of them and skipping, them if the test they depend on fails).

CrispJam
  • 159
  • 1
  • 6
  • 16
  • What about `pytest-ordering`? – iBug Feb 08 '19 at 15:25
  • 1
    Possible duplicate of [Test case execution order in pytest](https://stackoverflow.com/questions/17571438/test-case-execution-order-in-pytest) – iBug Feb 08 '19 at 15:26
  • If you absolutely need both test dependency (which is generally not a good thing, but can in a few cases be a necessary evil) and parallelism I assume you have quite extensive tests. Considering this is a rather uncommon and complicated use case, I think your best bet would be to fork pytest-xdist and implement dependency-handling yourself. An ugly workaround would be to organize your tests in classes (in case you haven't already) and handle the dependencies in a wrapper. – sjp Feb 08 '19 at 15:56
  • Does this answer your question? [invoking test case with in another test case in pytest framework](https://stackoverflow.com/questions/45210365/invoking-test-case-with-in-another-test-case-in-pytest-framework) – Alon Gouldman Jul 29 '20 at 11:21

0 Answers0