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

Deep copy mock data to avoid cross-test pollution #155

Merged
merged 1 commit into from
Feb 20, 2021

Conversation

graham33
Copy link
Contributor

Closes #121

@graham33
Copy link
Contributor Author

This may not be the cleanest approach, but it fixes the test for me.

@alandtse
Copy link
Collaborator

Thanks for putting this together. However, the ci test is failing now. Any thoughts on the cause?

Mock data was previously static dictionaries shared across all TeslaMock
instances, so accidental dependencies were introduced between the tests.  Now
each mock instance has its own deep copy.
@graham33
Copy link
Contributor Author

I wasn't running the asyncio tests in my environment, so didn't see that the data in TeslaMock needs to by shared for the lifetime of the test (mine returned a new deep copy on every function call). I've rewritten it and the tests now pass, but it's a more invasive change that could be done a few different ways. I've tried to keep the change minimal vs a big refactoring.

@graham33 graham33 mentioned this pull request Feb 20, 2021
@alandtse
Copy link
Collaborator

Great thanks!

@alandtse alandtse merged commit 12c02bc into zabuldon:dev Feb 20, 2021
@graham33 graham33 deleted the fix/test_isolation branch February 21, 2021 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure
2 participants