def test_pid_already_closed(): pidfile = pid.PidFile() pidfile.create() try: pidfile.fh.close() finally: pidfile.close()
def test_pid_check_samepid(): pidfile = pid.PidFile(allow_samepid=True) try: pidfile.create() pidfile.create() finally: pidfile.close()
def test_pid_already_closed(): pidfile = pid.PidFile() pidfile.create() try: pidfile.fh.close() finally: pidfile.close() assert not os.path.exists(pidfile.filename)
def test_pid_multiplecreate(): pidfile = pid.PidFile() pidfile.create() try: with raising(pid.PidFileAlreadyRunningError, pid.PidFileAlreadyLockedError): pidfile.create() finally: pidfile.close()
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()
def test_pid_multiplecreate(): pidfile = pid.PidFile() pidfile.create() try: with raising(pid.PidFileAlreadyRunningError, pid.PidFileAlreadyLockedError): pidfile.create() finally: pidfile.close() assert not os.path.exists(pidfile.filename)
def check_samepid(): pidfile = pid.PidFile(allow_samepid=True) try: pidfile.create() pidfile.create() finally: pidfile.close() assert not os.path.exists(pidfile.filename)