Skip to content

Commit

Permalink
Get rid of @attr
Browse files Browse the repository at this point in the history
  • Loading branch information
utkbansal committed Jul 14, 2017
1 parent 277127c commit 0dd3309
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 76 deletions.
4 changes: 0 additions & 4 deletions testsuite/MDAnalysisTests/analysis/test_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
assert_array_equal, assert_array_almost_equal,
assert_)
import numpy as np
from nose.plugins.attrib import attr

from MDAnalysisTests.datafiles import PSF, DCD, FASTA, ALIGN_BOUND, ALIGN_UNBOUND
from MDAnalysisTests import executable_not_found, parser_not_found, tempdir
Expand Down Expand Up @@ -262,7 +261,6 @@ def _assert_rmsd(self, fitted, frame, desired, weights=None):
err_msg="frame {0:d} of fit does not have "
"expected RMSD".format(frame))

@attr('issue')
def test_alignto_checks_selections(self):
"""Testing that alignto() fails if selections do not
match (Issue 143)"""
Expand Down Expand Up @@ -307,7 +305,6 @@ def setUp(self):
def tearDown(self):
del self.tempdir

@attr('issue')
def test_fasta2select_aligned(self):
"""test align.fasta2select() on aligned FASTA (Issue 112)"""
sel = align.fasta2select(self.seq, is_aligned=True)
Expand All @@ -317,7 +314,6 @@ def test_fasta2select_aligned(self):
assert_equal(len(sel['mobile']), 30623,
err_msg="selection string has unexpected length")

@attr('issue')
@dec.skipif(executable_not_found("clustalw2"),
msg="Test skipped because clustalw2 executable not found")
def test_fasta2select_ClustalW(self):
Expand Down
4 changes: 1 addition & 3 deletions testsuite/MDAnalysisTests/analysis/test_gnm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
from numpy.testing import (assert_equal, assert_almost_equal)
import numpy as np

from nose.plugins.attrib import attr

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


class TestGNM(TestCase):
def setUp(self):
self.tmpdir = tempdir.TempDir()
Expand Down Expand Up @@ -82,7 +82,6 @@ def test_generate_kirchoff(self):
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

@attr('slow')
def test_closeContactGNMAnalysis(self):
gnm = MDAnalysis.analysis.gnm.closeContactGNMAnalysis(self.universe, weights="size")
gnm.run()
Expand Down Expand Up @@ -113,7 +112,6 @@ def test_closeContactGNMAnalysis(self):
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, -2.263157894736841, -0.24333213169614382])

@attr('slow')
def test_closeContactGNMAnalysis_weights_None(self):
gnm = MDAnalysis.analysis.gnm.closeContactGNMAnalysis(self.universe, weights=None)
gnm.run()
Expand Down
11 changes: 0 additions & 11 deletions testsuite/MDAnalysisTests/analysis/test_hole.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import matplotlib
import mpl_toolkits.mplot3d

import nose
from nose.plugins.attrib import attr

import os
import errno
Expand Down Expand Up @@ -74,7 +72,6 @@ def tearDown(self):
del self.H
del self.tempdir

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_HOLE(self):
profiles = self.H.profiles.values()
Expand All @@ -90,7 +87,6 @@ def test_HOLE(self):
assert_almost_equal(p.radius.min(), 1.19707,
err_msg="wrong min HOLE radius")

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_vmd_surface(self):
with in_dir(self.tempdir.name):
Expand Down Expand Up @@ -127,7 +123,6 @@ def tearDownClass(cls):
del cls.universe

# This is VERY slow on 11 frames so we just take 2
@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_HOLEtraj(self):
assert_array_equal(sorted(self.H.profiles.keys()), self.frames,
Expand All @@ -143,29 +138,25 @@ def test_HOLEtraj(self):
assert_array_almost_equal(data[2], [1.19819, 1.29628],
err_msg="wrong minimum radius")

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_min_radius(self):
assert_array_almost_equal(self.H.min_radius(),
np.array([[ 5. , 1.19819],
[ 6. , 1.29628]]),
err_msg="min_radius() array not correct")

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_plot(self):
ax = self.H.plot(label=True)
assert_(isinstance(ax, matplotlib.axes.Axes),
msg="H.plot() did not produce an Axes instance")

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_plot3D(self):
ax = self.H.plot3D()
assert_(isinstance(ax, mpl_toolkits.mplot3d.Axes3D),
msg="H.plot3D() did not produce an Axes3D instance")

@attr('slow')
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_plot3D_rmax(self):
ax = self.H.plot3D(rmax=2.5)
Expand All @@ -184,8 +175,6 @@ def setUp(self):
except ImportError:
pass

@attr('slow')
@attr('issue')
@dec.skipif(rlimits_missing, msg="Test skipped because platform does not allow setting rlimits")
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_hole_module_fd_closure(self):
Expand Down
2 changes: 0 additions & 2 deletions testsuite/MDAnalysisTests/coordinates/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import numpy as np
import pytest
from six.moves import zip, range
from nose.plugins.attrib import attr
from unittest import TestCase
from numpy.testing import (assert_equal, assert_raises, assert_almost_equal,
assert_array_almost_equal, raises, assert_allclose,
Expand Down Expand Up @@ -622,7 +621,6 @@ def test_set_triclinic_vectors(self, ts):
assert_equal(ts.dimensions, self.newbox)
assert_allclose(ts._unitcell, self.unitcell)

@attr('issue')
def test_coordinate_getter_shortcuts(self, ts):
"""testing that reading _x, _y, and _z works as expected
# (Issue 224) (TestTimestep)"""
Expand Down
4 changes: 0 additions & 4 deletions testsuite/MDAnalysisTests/coordinates/test_chainreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import os
from six.moves import zip

from nose.plugins.attrib import attr
from numpy.testing import (assert_equal, assert_array_equal,
assert_almost_equal, dec)
from unittest import TestCase
Expand Down Expand Up @@ -156,22 +155,19 @@ class TestChainReaderFormats(TestCase):
"""Test of ChainReader with explicit formats (Issue 76)."""

@staticmethod
@attr('issue')
def test_set_all_format_tuples():
universe = mda.Universe(GRO, [(PDB, 'pdb'), (XTC, 'xtc'),
(TRR, 'trr')])
assert_equal(universe.trajectory.n_frames, 21)

@staticmethod
@attr('issue')
@dec.skipif(parser_not_found('DCD'),
'DCD parset not available. Are you using python 3?')
def test_set_one_format_tuple():
universe = mda.Universe(PSF, [(PDB_small, 'pdb'), DCD])
assert_equal(universe.trajectory.n_frames, 99)

@staticmethod
@attr('issue')
def test_set_all_formats():
universe = mda.Universe(PSF, [PDB_small, PDB_closed], format='pdb')
assert_equal(universe.trajectory.n_frames, 2)
5 changes: 0 additions & 5 deletions testsuite/MDAnalysisTests/coordinates/test_gro.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
GRO,
GRO_large,
)
from nose.plugins.attrib import attr
from numpy.testing import (
assert_,
assert_almost_equal,
Expand Down Expand Up @@ -252,7 +251,6 @@ def test_writer_no_atom_names(self, u_no_names, ref, tempdir):
assert_equal(u.atoms.names, expected)

@dec.slow
@attr('issue')
def test_check_coordinate_limits_min(self, ref, tempdir):
"""Test that illegal GRO coordinates (x <= -999.9995 nm) are caught
with ValueError (Issue 57)"""
Expand All @@ -264,7 +262,6 @@ def test_check_coordinate_limits_min(self, ref, tempdir):
assert_raises(ValueError, u.atoms.write, outfile)

@dec.slow
@attr('issue')
def test_check_coordinate_limits_max(self, ref, tempdir):
"""Test that illegal GRO coordinates (x > 9999.9995 nm) are caught
with ValueError (Issue 57)"""
Expand Down Expand Up @@ -394,7 +391,6 @@ def ref():
return GROLargeReference()

@dec.slow
@attr('issue')
def test_writer_large(self, ref, tempdir):
"""
Test that atom numbers are truncated for large
Expand All @@ -414,7 +410,6 @@ def test_writer_large(self, ref, tempdir):
"coords does not truncate properly.")

@dec.slow
@attr('issue')
def test_writer_large_residue_count(self, ref, tempdir):
"""
Ensure large residue number truncation for
Expand Down
3 changes: 0 additions & 3 deletions testsuite/MDAnalysisTests/coordinates/test_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from scipy.io import netcdf

import pytest
from nose.plugins.attrib import attr
from numpy.testing import (assert_, assert_equal, assert_array_almost_equal,
assert_array_equal,
assert_almost_equal, assert_raises, dec)
Expand Down Expand Up @@ -286,7 +285,6 @@ def _check_new_traj(self):
err_msg="Variable {0} not written "
"correctly".format(k))

@attr('slow')
def test_TRR2NCDF(self):
trr = mda.Universe(GRO, TRR)
with mda.Writer(self.outfile, trr.trajectory.n_atoms,
Expand Down Expand Up @@ -318,7 +316,6 @@ def test_TRR2NCDF(self):
err_msg="unitcells are not identical")
del trr

@attr('issue')
def test_write_AtomGroup(self):
"""test to write NCDF from AtomGroup (Issue 116)"""
p = self.universe.select_atoms("not resname WAT")
Expand Down
18 changes: 0 additions & 18 deletions testsuite/MDAnalysisTests/coordinates/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
INC_PDB, PDB_xlserial, ALIGN, ENT,
PDB_cm, PDB_cm_gz, PDB_cm_bz2,
PDB_mc, PDB_mc_gz, PDB_mc_bz2)
from nose.plugins.attrib import attr
from numpy.testing import (assert_equal, dec,
assert_array_almost_equal,
assert_almost_equal, assert_raises, assert_)
Expand Down Expand Up @@ -243,7 +242,6 @@ def test_writer_no_tempfactors(self):
expected = np.zeros(self.u_no_names.atoms.n_atoms)
assert_equal(u.atoms.tempfactors, expected)

@attr('issue')
def test_write_single_frame_Writer(self):
"""Test writing a single frame from a DCD trajectory to a PDB using
MDAnalysis.Writer (Issue 105)"""
Expand All @@ -257,7 +255,6 @@ def test_write_single_frame_Writer(self):
1,
err_msg="The number of frames should be 1.")

@attr('issue')
def test_write_single_frame_AtomGroup(self):
"""Test writing a single frame from a DCD trajectory to a PDB using
AtomGroup.write() (Issue 105)"""
Expand All @@ -273,7 +270,6 @@ def test_write_single_frame_AtomGroup(self):
"agree with original coordinates from frame %d" %
u.trajectory.frame)

@attr('issue')
def test_check_coordinate_limits_min(self):
"""Test that illegal PDB coordinates (x <= -999.9995 A) are caught
with ValueError (Issue 57)"""
Expand All @@ -283,7 +279,6 @@ def test_check_coordinate_limits_min(self):
u.atoms[2000].position = [0, -999.9995, 22.8]
assert_raises(ValueError, u.atoms.write, self.outfile)

@attr('issue')
def test_check_coordinate_limits_max(self):
"""Test that illegal PDB coordinates (x > 9999.9995 A) are caught
with ValueError (Issue 57)"""
Expand All @@ -295,7 +290,6 @@ def test_check_coordinate_limits_max(self):
assert_raises(ValueError, u.atoms.write, self.outfile)
del u

@attr('issue')
def test_check_header_title_multiframe(self):
"""Check whether HEADER and TITLE are written just once in a multi-
frame PDB file (Issue 741)"""
Expand Down Expand Up @@ -328,12 +322,10 @@ def tearDown(self):
del self.multiverse
del self.conect

@attr('slow')
def test_n_frames(self):
assert_equal(self.multiverse.trajectory.n_frames, 24,
"Wrong number of frames read from PDB muliple model file")

@attr('slow')
def test_n_atoms_frame(self):
u = self.multiverse
desired = 392
Expand All @@ -343,7 +335,6 @@ def test_n_atoms_frame(self):
"of atoms in the test case (%d) at frame %d" % (
len(u.atoms), desired, u.trajectory.frame))

@attr('slow')
def test_rewind(self):
u = self.multiverse
u.trajectory[11]
Expand All @@ -353,7 +344,6 @@ def test_rewind(self):
assert_equal(u.trajectory.ts.frame, 0,
"Failed to rewind to 0th frame (frame index 0)")

@attr('slow')
def test_iteration(self):
u = self.multiverse
frames = []
Expand All @@ -369,7 +359,6 @@ def test_iteration(self):
"trajectory iterator fails to rewind" %
(len(frames), u.trajectory.n_frames))

@attr('slow')
def test_slice_iteration(self):
u = self.multiverse
frames = []
Expand All @@ -379,7 +368,6 @@ def test_slice_iteration(self):
np.arange(u.trajectory.n_frames)[4:-2:4],
err_msg="slicing did not produce the expected frames")

@attr('slow')
def test_conect_bonds_conect(self):
conect = self.conect
assert_equal(len(conect.atoms), 1890)
Expand All @@ -395,7 +383,6 @@ def test_conect_bonds_conect(self):
assert_equal(len(u1.atoms), 1890)
assert_equal(len(u1.bonds), 1922)

@attr('slow')
def test_conect_bonds_all(self):
conect = self.conect
assert_equal(len(conect.atoms), 1890)
Expand All @@ -413,7 +400,6 @@ def test_conect_bonds_all(self):

# assert_equal(len([b for b in conect.bonds if not b.is_guessed]), 1922)

@attr('slow')
def test_numconnections(self):
u = self.multiverse

Expand Down Expand Up @@ -501,7 +487,6 @@ def tearDown(self):
del self.universe, self.multiverse, self.universe2
del self.tmpdir

@attr('slow')
def test_write_atomselection(self):
"""Test if multiframe writer can write selected frames for an
atomselection."""
Expand All @@ -524,7 +509,6 @@ def test_write_atomselection(self):
"AtomGroup contains %d frames, it should have %d" % (
len(u.trajectory), desired_frames))

@attr('slow')
def test_write_all_timesteps(self):
"""
Test write_all_timesteps() of the multiframe writer (selected frames
Expand All @@ -548,7 +532,6 @@ def test_write_all_timesteps(self):
"AtomGroup contains %d frames, it should have %d" % (
len(u.trajectory), desired_frames))

@attr('slow')
def test_write_atoms(self):
u = self.universe2
W = mda.Writer(self.outfile, multiframe=True)
Expand Down Expand Up @@ -632,7 +615,6 @@ def test_selection(self):
"Atom selection of last atoms in file")

@dec.slow
@attr('issue')
def test_unitcell(self):
assert_array_almost_equal(
self.universe.coord.dimensions,
Expand Down
Loading

0 comments on commit 0dd3309

Please sign in to comment.