You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/gevent/tests/test__memleak.py

57 lines
1.2 KiB

import sys
import unittest
from gevent.testing import TestCase, main
import gevent
from gevent.timeout import Timeout
@unittest.skipUnless(
hasattr(sys, 'gettotalrefcount'),
"Needs debug build"
)
class TestQueue(TestCase): # pragma: no cover
# pylint:disable=bare-except,no-member
def test(self):
result = ''
try:
Timeout.start_new(0.01)
gevent.sleep(1)
raise AssertionError('must raise Timeout')
except KeyboardInterrupt:
raise
except:
pass
result += '%s ' % sys.gettotalrefcount()
try:
Timeout.start_new(0.01)
gevent.sleep(1)
raise AssertionError('must raise Timeout')
except KeyboardInterrupt:
raise
except:
pass
result += '%s ' % sys.gettotalrefcount()
try:
Timeout.start_new(0.01)
gevent.sleep(1)
raise AssertionError('must raise Timeout')
except KeyboardInterrupt:
raise
except:
pass
result += '%s' % sys.gettotalrefcount()
_, b, c = result.split()
assert b == c, 'total refcount mismatch: %s' % result
if __name__ == '__main__':
main()