예제 #1
0
def test_pid_check_const_notrunning():
    with pid.PidFile() as pidfile:
        with open(pidfile.filename, "w") as f:
            # hope this does not clash
            f.write("999999999\n")
        assert pidfile.check() == pid.PID_CHECK_NOTRUNNING
    assert not os.path.exists(pidfile.filename)
예제 #2
0
파일: test_pid.py 프로젝트: elasti-rans/pid
def test_pid_check_const_empty():
    pidfile = pid.PidFile()
    pidfile.setup()
    try:
        with open(pidfile.filename, "w") as f:
            f.write("\n")
        assert pidfile.check() == pid.PID_CHECK_EMPTY
    finally:
        pidfile.close()
예제 #3
0
파일: test_pid.py 프로젝트: steph-ben/pid
def test_pid_check_const_empty():
    pidfile = pid.PidFile()
    pidfile.setup()
    try:
        with open(pidfile.filename, "w") as f:
            f.write("\n")
        assert pidfile.check() == pid.PID_CHECK_EMPTY
    finally:
        pidfile.close()
예제 #4
0
 def check_const_samepid():
     with pid.PidFile(allow_samepid=True) as pidfile:
         assert pidfile.check() == pid.PID_CHECK_SAMEPID
     assert not os.path.exists(pidfile.filename)
예제 #5
0
def test_pid_check_const_nofile():
    pidfile = pid.PidFile()
    assert pidfile.check() == pid.PID_CHECK_NOFILE
예제 #6
0
파일: test_pid.py 프로젝트: elasti-rans/pid
def test_pid_check_const_notrunning():
    with pid.PidFile() as pidfile:
        with open(pidfile.filename, "w") as f:
            # hope this does not clash
            f.write("999999999\n")
        assert pidfile.check() == pid.PID_CHECK_NOTRUNNING
예제 #7
0
파일: test_pid.py 프로젝트: elasti-rans/pid
def test_pid_check_const_samepid():
    with pid.PidFile(allow_samepid=True) as pidfile:
        assert pidfile.check() == pid.PID_CHECK_SAMEPID
예제 #8
0
파일: test_pid.py 프로젝트: elasti-rans/pid
def test_pid_check_const_nofile():
    pidfile = pid.PidFile()
    assert pidfile.check() == pid.PID_CHECK_NOFILE
예제 #9
0
파일: test_pid.py 프로젝트: steph-ben/pid
def test_pid_check_const_samepid():
    with pid.PidFile(allow_samepid=True) as pidfile:
        assert pidfile.check() == pid.PID_CHECK_SAMEPID