diff --git a/testsuite/MDAnalysisTests/topology/test_mmtf.py b/testsuite/MDAnalysisTests/topology/test_mmtf.py index 1389e567745..0c4bfd66051 100644 --- a/testsuite/MDAnalysisTests/topology/test_mmtf.py +++ b/testsuite/MDAnalysisTests/topology/test_mmtf.py @@ -108,11 +108,12 @@ def u(self): class TestMMTFFetch(TestMMTFUniverse): @pytest.fixture() - @mock.patch('mmtf.fetch') - def u(self, mock_fetch): + def u(self): top = mmtf.parse(MMTF) - mock_fetch.return_value = top - return mda.fetch_mmtf('173D') # string is irrelevant + with mock.patch('mmtf.fetch') as mock_fetch: + mock_fetch.return_value = top + + return mda.fetch_mmtf('173D') # string is irrelevant class TestSelectModels(object): diff --git a/testsuite/MDAnalysisTests/topology/test_pqr.py b/testsuite/MDAnalysisTests/topology/test_pqr.py index 216a7a71c2d..c6c89ab5d2b 100644 --- a/testsuite/MDAnalysisTests/topology/test_pqr.py +++ b/testsuite/MDAnalysisTests/topology/test_pqr.py @@ -90,7 +90,7 @@ def test_gromacs_flavour(): assert u.atoms[0].type == 'O' assert u.atoms[0].segid == 'SYSTEM' assert not u._topology.types.is_guessed - assert u.atoms[0].radius == pytest.approx(1.48) - assert u.atoms[0].charge == pytest.approx(-0.67) + assert_almost_equal(u.atoms[0].radius, 1.48, decimal=5) + assert_almost_equal(u.atoms[0].charge, -0.67, decimal=5) # coordinatey things assert_almost_equal(u.atoms[0].position, [15.710, 17.670, 23.340], decimal=4)