Skip to content

Commit

Permalink
pythongh-91051: fix type watcher test to be robust to existing watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Aug 16, 2023
1 parent bb456a0 commit 8c38bd5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Lib/test/test_capi/test_watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,10 @@ def test_clear_unassigned_watcher_id(self):
self.clear_watcher(1)

def test_no_more_ids_available(self):
contexts = [self.watcher() for i in range(self.TYPE_MAX_WATCHERS)]
with ExitStack() as stack:
for ctx in contexts:
stack.enter_context(ctx)
with self.assertRaisesRegex(RuntimeError, r"no more type watcher IDs"):
self.add_watcher()
with self.assertRaisesRegex(RuntimeError, r"no more type watcher IDs"):
with ExitStack() as stack:
while True:
stack.enter_context(self.watcher())


class TestCodeObjectWatchers(unittest.TestCase):
Expand Down

0 comments on commit 8c38bd5

Please sign in to comment.