Pytest Style analysis/test_hole.py #1539
Merged
Conversation
|
||
from MDAnalysisTests.datafiles import PDB_HOLE, MULTIPDB_HOLE | ||
from MDAnalysisTests import (executable_not_found, module_not_found, | ||
tempdir, in_dir) |
kain88-de
Jul 25, 2017
Member
import order is
- python std library
- external packages like numpy/pandas/...
- mdanalysis specific packages
- testing specific packages
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) |
kain88-de
Jul 25, 2017
Member
please remove the tempdir dependency
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(): |
kain88-de
Jul 25, 2017
Member
use a tmpdir_factory here
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): |
kain88-de
Jul 25, 2017
Member
should be a fixture
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() |
kain88-de
Jul 25, 2017
Member
Shouldn't this be a static method for pytest to work?
Shouldn't this be a static method for pytest to work?
utkbansal
Jul 26, 2017
Author
Member
I don't think so. I can move filename = PDB_HOLE
to the fixture though and make it a staticmethod.
I don't think so. I can move filename = PDB_HOLE
to the fixture though and make it a staticmethod.
kain88-de
Jul 26, 2017
Member
so far you made all fixtures in a class static. I was wondering why this isn't necessary here.
so far you made all fixtures in a class static. I was wondering why this isn't necessary here.
utkbansal
Jul 26, 2017
Author
Member
@kain88-de I sometimes need to access self
from within the fixture. That is when I don't make it static.
@kain88-de I sometimes need to access self
from within the fixture. That is when I don't make it static.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Fixes #
Changes made in this Pull Request:
PR Checklist