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

[WIP]Pytest Style analysis/test_density.py #1543

Merged
merged 3 commits into from Aug 5, 2017

Conversation

@utkbansal
Copy link
Member

@utkbansal utkbansal commented Jul 23, 2017

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?
@kain88-de
Copy link
Member

@kain88-de kain88-de commented Jul 26, 2017

build fails

@kain88-de
Copy link
Member

@kain88-de kain88-de commented Jul 29, 2017

build still fails

@utkbansal
Copy link
Member Author

@utkbansal utkbansal commented Jul 30, 2017

@kain88-de Can't figure what I broke in

def test_grid(self, D):
        dV = D.delta.prod()  # orthorhombic grids only!
        # counts = (rho[0] * dV[0] + rho[1] * dV[1] ...) = sum_i rho[i] * dV
        assert_almost_equal(D.grid.sum() * dV, self.counts)
@utkbansal
Copy link
Member Author

@utkbansal utkbansal commented Aug 3, 2017

@kain88-de Need help here.

@kain88-de
Copy link
Member

@kain88-de kain88-de commented Aug 3, 2017

@jbarnoud or @mnmelo could you have a look?

@jbarnoud
Copy link
Contributor

@jbarnoud jbarnoud commented Aug 3, 2017

On line 45, as you declare class attributes, you use the class attribute Lmax to build the other class attribute bins. When you do this, it seems that python tries to find Lmax in the parent scope rather than using the TestDensity.Lmax you just defined.

I think you need to create a fixture for bins. This fixture can have the class as scope.

@kain88-de
Copy link
Member

@kain88-de kain88-de commented Aug 3, 2017

Yes python doesn't allow using the attributes you declare in a list comprehension


from MDAnalysisTests.datafiles import TPR, XTC, GRO
from MDAnalysisTests import module_not_found, tempdir
from MDAnalysisTests import tempdir

This comment has been minimized.

@kain88-de

kain88-de Aug 5, 2017
Member

please also remove the tempdir usage if you haven't done so already.

utkbansal added 3 commits Jul 23, 2017
@utkbansal utkbansal force-pushed the utkbansal:analysis-density branch from a137d8f to 2394f1d Aug 5, 2017
@kain88-de kain88-de merged commit 2542b16 into MDAnalysis:develop Aug 5, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.01%) to 90.575%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants