3
# Comment the line below to see that the standard thread.local is working correct
4
from gevent import monkey; monkey.patch_all()
7
from threading import local
9
__slots__ = ['initialized','obj']
12
def __init__(self, obj):
13
if not hasattr(self, 'initialized'):
20
class GeventLocalTestCase(unittest.TestCase):
28
Copy makes a shallow copy. Meaning that the attribute path
29
has to be independent in the original and the copied object because the
30
value is a string, but the attribute obj should be just reference to
31
the instance of the class Obj
33
self.assertEqual(a.path, b.path, 'The values in the two objects must be equal')
34
self.assertEqual(a.obj, b.obj, 'The values must be equal')
37
self.assertNotEqual(a.path, b.path, 'The values in the two objects must be different')
40
self.assertEqual(a.obj, b.obj, 'The values must be equal')
42
def test_objects(self):
44
Test which failed in the eventlet?!
50
self.assertEqual(a.path, b.path, 'The values in the two objects must be equal')
54
self.assertNotEqual(a.path, b.path, 'The values in the two objects must be different')
56
if __name__ == '__main__':