MCPcopy Create free account
hub / github.com/celery/celery / test_init

Method test_init

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

Source from the content-addressed store, hash-verified

223class test_LocalManager:
224
225 def test_init(self):
226 x = LocalManager()
227 assert x.locals == []
228 assert x.ident_func
229
230 def ident():
231 return 1
232 loc = Local()
233 x = LocalManager([loc], ident_func=ident)
234 assert x.locals == [loc]
235 x = LocalManager(loc, ident_func=ident)
236 assert x.locals == [loc]
237 assert x.ident_func is ident
238 assert x.locals[0].__ident_func__ is ident
239 assert x.get_ident() == 1
240
241 with patch('celery.utils.threads.release_local') as release:
242 x.cleanup()
243 release.assert_called_with(loc)
244
245 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