Skip to content

Commit

Permalink
Merge pull request #124 from sroet/fix_pytests8_warning
Browse files Browse the repository at this point in the history
use new way of checking for no warnings
  • Loading branch information
dwhswenson authored Jan 29, 2024
2 parents 7fbb0b0 + 0a1a390 commit f276750
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions contact_map/tests/test_contact_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ def test_plot_kwargs(self):
@pytest.mark.skipif(not HAS_MATPLOTLIB, reason="Missing matplotlib")
def test_pixel_warning(self):
# This should not raise a warning (5*2>=10)
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter('error')
self.atom_contacts.plot(figsize=(5, 5), dpi=2)
# See if no warning was raised
assert len(record) == 0

# Now raise the warning as 4*2 < 10
with pytest.warns(RuntimeWarning) as record:
Expand Down

0 comments on commit f276750

Please sign in to comment.