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_diffusionmap.py #1540

Merged
merged 3 commits into from Jul 29, 2017

Conversation

Projects
None yet
3 participants
@utkbansal
Member

utkbansal commented Jul 23, 2017

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?
from MDAnalysisTests.datafiles import PDB, XTC
class TestDiffusionmap(object):

This comment has been minimized.

@kain88-de

kain88-de Jul 24, 2017

Member

No class needed this is a single file

@staticmethod
@pytest.fixture()
def eigvals(dmap):
return dmap.eigenvalues

This comment has been minimized.

@kain88-de

kain88-de Jul 24, 2017

Member

Please don't use a fixture for this

This comment has been minimized.

@utkbansal

utkbansal Jul 25, 2017

Member

What should I do with it then? Since there is no class, I can't attach it with self in some other fixture. Should I directly use the values from the dmap fixture?

This comment has been minimized.

@kain88-de

kain88-de Jul 25, 2017

Member

just use the dmap fixture in functions that want this fixture

This comment has been minimized.

@utkbansal
dist.run()
dmap = diffusionmap.DiffusionMap(dist)
dmap.run()
assert_array_almost_equal(dmap.eigenvalues, [1, 1, 1, 1], 4)

This comment has been minimized.

@kain88-de

kain88-de Jul 24, 2017

Member

You are recalculating the dmap fixture here.

This comment has been minimized.

@utkbansal

utkbansal Jul 25, 2017

Member

I don' think so. The value of dist is different here. It has weights=weights_atoms, step=3 which isn't in the dist fixture that is used by the dmap fixture.

@utkbansal utkbansal changed the title from [WIP]Pytest Style analysis/test_diffusionmap.py to Pytest Style analysis/test_diffusionmap.py Jul 25, 2017

weights_atoms = np.ones(len(backbone.atoms))
dist = diffusionmap.DistanceMatrix(u, select='backbone', weights=weights_atoms, step=3)
dist.run()
dmap = diffusionmap.DiffusionMap(dist)

This comment has been minimized.

@richardjgowers

richardjgowers Jul 25, 2017

Member

isn't this the dmap fixture?

This comment has been minimized.

@richardjgowers

richardjgowers Jul 25, 2017

Member

Ok it's slightly different

@pytest.fixture()
def dmap(dist):

This comment has been minimized.

@kain88-de

kain88-de Jul 26, 2017

Member

This can be a module wide fixture

@utkbansal

This comment has been minimized.

Member

utkbansal commented Jul 27, 2017

@kain88-de Better now?

@kain88-de kain88-de merged commit fda6e36 into MDAnalysis:develop Jul 29, 2017

2 of 3 checks passed

coverage/coveralls Coverage decreased (-0.03%) to 90.399%
Details
QuantifiedCode No new issues introduced.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment