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

25 lines
523 B

from gevent import monkey; monkey.patch_all()
import threading
localdata = threading.local()
localdata.x = "hello"
assert localdata.x == 'hello'
success = []
def func():
try:
getattr(localdata, 'x')
raise AssertionError('localdata.x must raise AttributeError')
except AttributeError:
pass
assert localdata.__dict__ == {}, localdata.__dict__
success.append(1)
t = threading.Thread(None, func)
t.start()
t.join()
assert success == [1], 'test failed'
assert localdata.x == 'hello'