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 | 59beb8737dedf31fb96344201753e5b76d0a0cae (patch) | |
tree | a9589a139640c601f6e8551c3431d383ffcbc9fa /tests/test_concurrency.py | |
parent | d1a7c09d300376ab6dbe2d920779e15cdc73fd1c (diff) | |
download | python-coveragepy-59beb8737dedf31fb96344201753e5b76d0a0cae.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 5ea756f..6fbac4a 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`.""" |