Skip to content
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

When files contain more than one snapshot, ./manage.py test --parallel causes a race condition #56

Open
rekahsoft opened this issue Aug 13, 2018 · 3 comments

Comments

@rekahsoft
Copy link

When tests are run in parallel, snapshottest writes the resulting snapshot to a file based on the name of the python source file. For example, test_something.py results in snap_test_something.py. This however seems to lead to race conditions when a file contains more then one snapshot test and tests are run in parallel using ./manage.py test --parallel 4 which has different resulting snapshots then when running ./manage.py test.

@paulmelnikow
Copy link
Collaborator

As I mentioned in #107, I wonder if the fix might be to provide a way to pass this option through an environment variable, which subprocesses would then automatically inherit.

@paulmelnikow
Copy link
Collaborator

his however seems to lead to race conditions when a file contains more then one snapshot test and tests are run in parallel using ./manage.py test --parallel 4 which has different resulting snapshots then when running ./manage.py test.

Right, so this is the problem. It's not about passing the option through.

Hmm, I wonder if we could add an option where each snapshot is written to its own file. I think that's the only real way to solve this.

@paulmelnikow paulmelnikow changed the title Snapshottest does not function correctly when --parallel is used When files contain more than one snapshot, ./manage.py test --parallel causes a race condition Sep 29, 2020
@zeroindex
Copy link

I'm curious if anything ever came of this. Is there a flag to get each snapshot into its own file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants