diff --git a/contact_map/tests/test_concurrence.py b/contact_map/tests/test_concurrence.py index 0347b5d..92b53bb 100644 --- a/contact_map/tests/test_concurrence.py +++ b/contact_map/tests/test_concurrence.py @@ -65,7 +65,7 @@ def _test_getitem(self, concurrence, pair_to_expected): class TestAtomContactConcurrence(ContactConcurrenceTester): - def setup(self): + def setup_method(self): self.concurrence = AtomContactConcurrence( trajectory=traj, atom_contacts=contacts.atom_contacts.most_common(), @@ -105,7 +105,7 @@ def test_set_labels(self): class TestResidueContactConcurrence(ContactConcurrenceTester): - def setup(self): + def setup_method(self): self.heavy_contact_concurrence = ResidueContactConcurrence( trajectory=traj, residue_contacts=contacts.residue_contacts.most_common(), @@ -157,7 +157,7 @@ def test_getitem(self, conc_type): class TestConcurrencePlotter(object): - def setup(self): + def setup_method(self): self.concurrence = ResidueContactConcurrence( trajectory=traj, residue_contacts=contacts.residue_contacts.most_common(), diff --git a/contact_map/tests/test_contact_count.py b/contact_map/tests/test_contact_count.py index 1924ed7..edd2d48 100644 --- a/contact_map/tests/test_contact_count.py +++ b/contact_map/tests/test_contact_count.py @@ -14,7 +14,7 @@ from contact_map.contact_count import * class TestContactCount(object): - def setup(self): + def setup_method(self): self.map = ContactFrequency(traj, cutoff=0.075, n_neighbors_ignored=0) self.topology = self.map.topology @@ -65,6 +65,7 @@ def test_pixel_warning(self): with warnings.catch_warnings(): warnings.simplefilter('error') self.atom_contacts.plot(figsize=(5, 5), dpi=2) + # should convert to error if warning issued # Now raise the warning as 4*2 < 10 with pytest.warns(RuntimeWarning) as record: diff --git a/contact_map/tests/test_contact_map.py b/contact_map/tests/test_contact_map.py index 60f4f3d..673c2b9 100644 --- a/contact_map/tests/test_contact_map.py +++ b/contact_map/tests/test_contact_map.py @@ -117,7 +117,7 @@ class TestContactObject(object): # note: these used to be the tests for the separate single-frame # ContactMap class; however, it includes a lot of good unit tests for # ContactObject - def setup(self): + def setup_method(self): self.topology = traj.topology self.map0 = ContactFrequency(traj[0], cutoff=0.075, n_neighbors_ignored=0) @@ -336,7 +336,7 @@ def test_no_unitcell(self, idx): class TestContactFrequency(object): - def setup(self): + def setup_method(self): self.atoms = [0, 1, 4, 5, 6, 7, 8, 9] self.map = ContactFrequency(trajectory=traj, cutoff=0.075, diff --git a/contact_map/tests/test_contact_trajectory.py b/contact_map/tests/test_contact_trajectory.py index c9575a4..0857c13 100644 --- a/contact_map/tests/test_contact_trajectory.py +++ b/contact_map/tests/test_contact_trajectory.py @@ -31,7 +31,7 @@ ] class TestContactTrajectory(object): - def setup(self): + def setup_method(self): self.traj = md.load(find_testfile("trajectory.pdb")) self.map = ContactTrajectory(self.traj, cutoff=0.075, n_neighbors_ignored=0) @@ -175,7 +175,7 @@ def test_rolling_frequency(self): class TestMutableContactTrajectory(object): - def setup(self): + def setup_method(self): self.traj = md.load(find_testfile("trajectory.pdb")) self.map = MutableContactTrajectory(self.traj, cutoff=0.075, n_neighbors_ignored=0) @@ -223,7 +223,7 @@ def test_hash_eq(self): class TestWindowedIterator(object): - def setup(self): + def setup_method(self): self.iter = WindowedIterator(length=10, width=3, step=2, slow_build=False) @@ -286,7 +286,7 @@ def test_next(self, length, width, step, slow_build, expected): class TestRollingContactFrequency(object): - def setup(self): + def setup_method(self): self.traj = md.load(find_testfile("trajectory.pdb")) self.map = ContactTrajectory(self.traj, cutoff=0.075, n_neighbors_ignored=0) diff --git a/contact_map/tests/test_dask_runner.py b/contact_map/tests/test_dask_runner.py index d704db5..7717d38 100644 --- a/contact_map/tests/test_dask_runner.py +++ b/contact_map/tests/test_dask_runner.py @@ -29,7 +29,7 @@ def dask_setup_test_cluster(distributed, n_workers=4, n_attempts=3): class TestDaskRunners(object): - def setup(self): + def setup_method(self): dask = pytest.importorskip('dask') # pylint: disable=W0612 distributed = pytest.importorskip('dask.distributed') self.distributed = distributed @@ -39,7 +39,7 @@ def setup(self): self.client = distributed.Client(self.cluster) self.filename = find_testfile("trajectory.pdb") - def teardown(self): + def teardown_method(self): self.client.shutdown() @pytest.mark.parametrize("dask_cls", [DaskContactFrequency, diff --git a/contact_map/tests/test_frequency_task.py b/contact_map/tests/test_frequency_task.py index 069b8d0..6ba9dd5 100644 --- a/contact_map/tests/test_frequency_task.py +++ b/contact_map/tests/test_frequency_task.py @@ -33,7 +33,7 @@ def test_default_slice_even_split(self, inputs, results): assert default_slices(n_total, n_workers) == results class TestTasks(object): - def setup(self): + def setup_method(self): self.contact_freq_0_4 = ContactFrequency(traj[:4], cutoff=0.075, n_neighbors_ignored=0) self.contact_freq_4 = ContactFrequency(traj[4], cutoff=0.075, diff --git a/contact_map/tests/test_min_dist.py b/contact_map/tests/test_min_dist.py index 5193f3d..e2da536 100644 --- a/contact_map/tests/test_min_dist.py +++ b/contact_map/tests/test_min_dist.py @@ -14,7 +14,7 @@ @pytest.mark.parametrize("idx", [0, 4]) class TestNearestAtoms(object): - def setup(self): + def setup_method(self): self.nearest_atoms = { idx: NearestAtoms(traj, cutoff=0.075, frame_number=idx) for idx in [0, 4] @@ -107,7 +107,7 @@ def test_sorted_distances(self, idx): class TestMinimumDistanceCounter(object): - def setup(self): + def setup_method(self): self.topology = traj.topology query = [4, 5] haystack = list(set(range(10)) - set(query)) diff --git a/contact_map/tests/test_plot_utils.py b/contact_map/tests/test_plot_utils.py index 8a3d3c2..c52f9b3 100644 --- a/contact_map/tests/test_plot_utils.py +++ b/contact_map/tests/test_plot_utils.py @@ -72,7 +72,7 @@ def test_is_cmap_diverging(cmap): class TestContactRange(object): - def setup(self): + def setup_method(self): self.cr = _ContactPlotRange(5) @pytest.mark.parametrize("case", [(_ContactPlotRange(5), True),