Example #1
0
def test_lock_with_pid_file(tmpdir):
    pid_file = Path(tmpdir) / "test.pid"

    daemon.lock_with_pid_file(pid_file)

    assert store.have_lock("%s" % pid_file)

    with pid_file.open() as f:
        assert int(f.read()) == os.getpid()
Example #2
0
def test_cleanup_locked_pid_file(tmpdir):
    pid_file = Path(tmpdir) / "test.pid"

    assert not store.have_lock("%s" % pid_file)
    daemon.lock_with_pid_file(pid_file)
    assert store.have_lock("%s" % pid_file)

    daemon._cleanup_locked_pid_file(pid_file)

    assert not store.have_lock("%s" % pid_file)