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__threading_before_monk...

24 lines
675 B

# If stdlib threading is imported *BEFORE* monkey patching,
# we can still get the current (main) thread, and it's not a DummyThread.
import threading
from gevent import monkey
monkey.patch_all()
import gevent.testing as greentest
class Test(greentest.TestCase):
def test_main_thread(self):
current = threading.current_thread()
self.assertFalse(isinstance(current, threading._DummyThread))
self.assertTrue(isinstance(current, monkey.get_original('threading', 'Thread')))
# in 3.4, if the patch is incorrectly done, getting the repr
# of the thread fails
repr(current)
if __name__ == '__main__':
greentest.main()