diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-11-08 18:42:32 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-11-08 18:42:32 -0500 |
commit | 81f5697e7cb2f5a064fd891617c0c8caf5ab21d9 (patch) | |
tree | dd15fff5b8c4b75667d66d526312c9ba85f40aa7 /tests/test_concurrency.py | |
parent | 81aa202a558a02b4a2b3d17b4a1764f79a3194e9 (diff) | |
download | python-coveragepy-git-81f5697e7cb2f5a064fd891617c0c8caf5ab21d9.tar.gz |
Use a WeakKeyDictionary to track coroutine objects to prevent leaks. Fixes #330.
Diffstat (limited to 'tests/test_concurrency.py')
-rw-r--r-- | tests/test_concurrency.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 5ea756f6..6fbac4a6 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -201,6 +201,24 @@ class ConcurrencyTest(CoverageTest): def test_greenlet_simple_code(self): self.try_some_code(self.SIMPLE, "greenlet", greenlet) + def test_bug_330(self): + BUG_330 = """\ + from weakref import WeakKeyDictionary + import eventlet + + def do(): + eventlet.sleep(.01) + + gts = WeakKeyDictionary() + for _ in range(100): + gts[eventlet.spawn(do)] = True + eventlet.sleep(.005) + + eventlet.sleep(.1) + print len(gts) + """ + self.try_some_code(BUG_330, "eventlet", eventlet, "0\n") + def print_simple_annotation(code, linenos): """Print the lines in `code` with X for each line number in `linenos`.""" |