MCPcopy
hub / github.com/celery/celery / test_init

Method test_init

t/unit/utils/test_threads.py:83–103  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

81class test_LocalManager:
82
83 def test_init(self):
84 x = LocalManager()
85 assert x.locals == []
86 assert x.ident_func
87
88 def ident():
89 return 1
90 loc = Local()
91 x = LocalManager([loc], ident_func=ident)
92 assert x.locals == [loc]
93 x = LocalManager(loc, ident_func=ident)
94 assert x.locals == [loc]
95 assert x.ident_func is ident
96 assert x.locals[0].__ident_func__ is ident
97 assert x.get_ident() == 1
98
99 with patch('celery.utils.threads.release_local') as release:
100 x.cleanup()
101 release.assert_called_with(loc)
102
103 assert repr(x)

Callers

nothing calls this directly

Calls 4

get_identMethod · 0.95
cleanupMethod · 0.95
LocalManagerClass · 0.90
LocalClass · 0.90

Tested by

no test coverage detected