Skip to content

Commit

Permalink
Avoid 3.10+ test method.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyandrewmeyer committed Sep 25, 2023
1 parent 79a509d commit db228e9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,16 @@ def test_ignored(self, fake_stderr):
os.environ.pop('JUJU_DEBUG_AT', None)
framework = self.create_framework()

with self.assertNoLogs(level="WARNING"):
with patch('pdb.Pdb.set_trace') as mock:
framework.breakpoint()
with patch('pdb.Pdb.set_trace') as mock:
# We want to verify that there are *no* logs at warning level.
# However, assertNoLogs is Python 3.10+.
try:
with self.assertLogs(level="WARNING"):
framework.breakpoint()
except AssertionError:
pass
else:
self.fail("No warning logs should be generated")
self.assertEqual(mock.call_count, 0)
self.assertEqual(fake_stderr.getvalue(), "")

Expand Down

0 comments on commit db228e9

Please sign in to comment.