mirror of
https://github.com/python/cpython.git
synced 2024-11-24 10:24:35 +08:00
gh-91051: fix type watcher test to be robust to existing watcher (#107989)
This commit is contained in:
parent
8891a8821d
commit
fce93c80ae
@ -351,12 +351,10 @@ class TestTypeWatchers(unittest.TestCase):
|
||||
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:
|
||||
for _ in range(self.TYPE_MAX_WATCHERS + 1):
|
||||
stack.enter_context(self.watcher())
|
||||
|
||||
|
||||
class TestCodeObjectWatchers(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user