Skip to content

Commit

Permalink
Merge pull request #568 from jbarnoud/testdep
Browse files Browse the repository at this point in the history
Skip tests if scipy or NetCDF are missing
  • Loading branch information
richardjgowers committed Dec 8, 2015
2 parents e203b80 + 4278160 commit 80ec06c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions testsuite/MDAnalysisTests/analysis/test_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
from __future__ import print_function

import MDAnalysis
import MDAnalysis.analysis.distances
from MDAnalysisTests import module_not_found

from numpy.testing import TestCase, assert_equal
from numpy.testing import TestCase, assert_equal, dec
import numpy as np


class TestContactMatrix(TestCase):

@dec.skipif(module_not_found('scipy'),
"Test skipped because scipy is not available.")
def setUp(self):
import MDAnalysis.analysis.distances
self.coord = np.array([[1, 1, 1],
[5, 5, 5],
[1.1, 1.1, 1.1],
Expand Down
7 changes: 5 additions & 2 deletions testsuite/MDAnalysisTests/analysis/test_leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
import MDAnalysis
from MDAnalysis.analysis.leaflet import LeafletFinder
from MDAnalysisTests import module_not_found

from numpy.testing import TestCase, assert_equal
from numpy.testing import TestCase, assert_equal, dec
import numpy as np

from MDAnalysisTests.datafiles import Martini_membrane_gro

class TestLeafletFinder(TestCase):
@dec.skipif(module_not_found('scipy'),
"Test skipped because scipy is not available.")
def setUp(self):
self.universe = MDAnalysis.Universe(Martini_membrane_gro, Martini_membrane_gro)
self.lipid_heads = self.universe.select_atoms("name PO4")
Expand All @@ -30,6 +32,7 @@ def tearDown(self):
del self.universe

def test_leaflet_finder(self):
from MDAnalysis.analysis.leaflet import LeafletFinder
lfls = LeafletFinder(self.universe, self.lipid_heads, pbc=True)
top_heads, bottom_heads = lfls.groups()
# Make top be... on top.
Expand Down
5 changes: 4 additions & 1 deletion testsuite/MDAnalysisTests/coordinates/test_dcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
from nose.plugins.attrib import attr
from numpy.testing import (assert_equal, assert_array_equal, assert_raises,
assert_almost_equal, assert_array_almost_equal,
assert_allclose)
assert_allclose, dec)
import tempdir
from unittest import TestCase

from MDAnalysisTests.datafiles import (DCD, PSF, DCD_empty, CRD, PRMncdf, NCDF)
from MDAnalysisTests.coordinates.reference import (RefCHARMMtriclinicDCD,
RefNAMDtriclinicDCD)
from MDAnalysisTests.coordinates.base import BaseTimestepTest
from MDAnalysisTests import module_not_found


@attr('issue')
Expand Down Expand Up @@ -369,6 +370,8 @@ class TestDCDReader_NAMD_Unitcell(_TestDCDReader_TriclinicUnitcell,


class TestNCDF2DCD(TestCase):
@dec.skipif(module_not_found("netCDF4"),
"Test skipped because netCDF is not available.")
def setUp(self):
self.u = mda.Universe(PRMncdf, NCDF)
# create the DCD
Expand Down

0 comments on commit 80ec06c

Please sign in to comment.