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

Method test_create_pidlock

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

Source from the content-addressed store, hash-verified

673
674 @patch('celery.platforms.Pidfile')
675 def test_create_pidlock(self, Pidfile):
676 p = Pidfile.return_value = Mock()
677 p.is_locked.return_value = True
678 p.remove_if_stale.return_value = False
679 with conftest.stdouts() as (_, err):
680 with pytest.raises(SystemExit):
681 create_pidlock('/var/pid')
682 assert 'already exists' in err.getvalue()
683
684 p.remove_if_stale.return_value = True
685 ret = create_pidlock('/var/pid')
686 assert ret is p
687
688 def test_context(self):
689 p = Pidfile('/var/pid')

Callers

nothing calls this directly

Calls 2

create_pidlockFunction · 0.90
raisesMethod · 0.80

Tested by

no test coverage detected