-
Notifications
You must be signed in to change notification settings - Fork 696
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 analysis/test_hole.py #1539
Conversation
|
||
from MDAnalysisTests.datafiles import PDB_HOLE, MULTIPDB_HOLE | ||
from MDAnalysisTests import (executable_not_found, module_not_found, | ||
tempdir, in_dir) |
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.
import order is
- python std library
- external packages like numpy/pandas/...
- mdanalysis specific packages
- testing specific packages
|
||
from numpy.testing import (TestCase, dec, | ||
assert_equal, assert_almost_equal, | ||
from MDAnalysisTests import (executable_not_found, tempdir, in_dir) |
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.
please remove the tempdir dependency
for ts in cls.universe.trajectory[cls.start:cls.stop]] | ||
@pytest.fixture() | ||
def H(self, universe): | ||
with tempdir.in_tempdir(): |
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.
use a tmpdir_factory here
class TestHOLE(TestCase): | ||
filename = PDB_HOLE | ||
|
||
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found") | ||
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.
should be a fixture
@kain88-de Anything else? |
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found") | ||
def setUp(self): | ||
|
||
@pytest.fixture() |
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.
Shouldn't this be a static method for pytest to work?
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 so. I can move filename = PDB_HOLE
to the fixture though and make it a staticmethod.
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 far you made all fixtures in a class static. I was wondering why this isn't necessary here.
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.
@kain88-de I sometimes need to access self
from within the fixture. That is when I don't make it static.
Fixes #
Changes made in this Pull Request:
PR Checklist