MCPcopy
hub / github.com/celery/celery / test_create_pidlock

Method test_create_pidlock

t/unit/utils/test_platforms.py:525–536  ·  view source on GitHub ↗
(self, Pidfile)

Source from the content-addressed store, hash-verified

523
524 @patch('celery.platforms.Pidfile')
525 def test_create_pidlock(self, Pidfile):
526 p = Pidfile.return_value = Mock()
527 p.is_locked.return_value = True
528 p.remove_if_stale.return_value = False
529 with conftest.stdouts() as (_, err):
530 with pytest.raises(SystemExit):
531 create_pidlock('/var/pid')
532 assert 'already exists' in err.getvalue()
533
534 p.remove_if_stale.return_value = True
535 ret = create_pidlock('/var/pid')
536 assert ret is p
537
538 def test_context(self):
539 p = Pidfile('/var/pid')

Callers

nothing calls this directly

Calls 2

create_pidlockFunction · 0.90
raisesMethod · 0.45

Tested by

no test coverage detected