-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invoke setUpClass() many times under running multiple cpu mode #15
Comments
It's one per process. So how it works is, xdist takes all the tests and split them into 3 test sets, and set up function is executed for each set. In you case I think this is badly written test. I think you should use https://docs.python.org/2/library/tempfile.html to create test file/directories and remove them at tear_down, or better, there are some fixtures which helps with that (https://pytest.org/latest/tmpdir.html) |
that's working as designed |
hello spinus in my scenario, I want to insert data to database in setUpClass() in every test case. Repeatedly calling the method will lead to data chaos :( thx |
i found this topic, maybe i can try the solution of @piwai by using ClassLoadScheduling "way to control how pytest-xdist runs tests in parallel? #175" |
i fork xdist and merge @piwai code,and fix problem,now it works. |
@heipark why not just isolate the tests? You can create database in setup method (with worker number in the name) |
that fork looks interesting |
its solving a completely different problem that incidentially solves the problem @heipark has due to distribution strategies |
I have been working on the background on writing up a more generic proposal on controlling how |
@spinus how to get worker name (subprocess name ?) in setUp() and test method? thx |
You can use an environment variable for that, I forget the name right now but it is in the readme |
os: win7
py:2.7 && pytest (2.8.2) && pytest-xdist (1.13.1)
command:
content of c:/abc.txt:
xdist can not guarantee setUpClass() only run once ?
The text was updated successfully, but these errors were encountered: