From 8971c1a79b1024e50e20564de3113ed3c3bc809f Mon Sep 17 00:00:00 2001 From: richardjgowers Date: Fri, 3 Aug 2018 09:15:36 -0500 Subject: [PATCH 1/2] removed use of pytest.approx --- testsuite/MDAnalysisTests/topology/test_pqr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From 96af8adc666added9669e8543a18d3d3f308bdd0 Mon Sep 17 00:00:00 2001 From: richardjgowers Date: Fri, 3 Aug 2018 15:28:44 -0500 Subject: [PATCH 2/2] removed mock decorator, playing badly with pytest fixtures --- testsuite/MDAnalysisTests/topology/test_mmtf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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):