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
Pytest Style: test_persistence.py #1470
Conversation
@kain88-de Have a look at |
|
||
|
||
|
||
# def setUp(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs removing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't cleaned this up because the tests are still failing. Need to fix that first.
# Kill AtomGroup and Universe | ||
del self.ag_n | ||
del self.universe_n | ||
del ag_n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that del
makes sense with these fixtures.
Try not to pass them as arguments and leave out the del
lines. Maybe they never appear... but in this case, I have no idea what the deep pytest magic actually does.
You should also be able to remove the gc.collect()
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the del
might not be playing nice with the fixtures, but it's essential to the test. These tests are trying to see what happens when a Universe goes out of scope (is deleted and garbage collected).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to leave out the fixtures and then not need to explicitly del
them – if pytest only creates the fixture for each method.
@utkbansal fot the tests which rely on |
@richardjgowers The test does work that way. But it's a hack. |
@utkbansal the test relies on the Universe becoming garbage collected, so I think having the fixture hold a reference to the Universe is breaking the test. I can't really see a way round a fixture providing an object but not retaining a reference to it. |
@richardjgowers Anything left here? |
Fixes #
Changes made in this Pull Request:
PR Checklist