Reputation: 41
I have a test suite that used to be executed with pytest and I used the method before_all_tests(request)
in each test file to initialize the db mockups for those tests.
I wanted to use pytest-xdist
to run them parallelly, but before_all_tests(request)
is not being executed if I run pytest -n X
(parallelly).
Now I don't know how to re-write all my code so that I can only initialize the mocks of the tests being executed :(
I use markers to categorize tests, so sometimes I only run tests under a single category or just a bunch of them. I don't want to initialize the mocks of all the tests files because not all of them will be executed at that time.
Can anybody help me? I can post some code if necessary.
Thanks in advance!!
Upvotes: 0
Views: 1009