def test_get_running_pid_not_integer(tmpdir): """Assert function returns None when the content is not an Integer""" pid_file = tmpdir.join('sopel.pid') pid_file.write('') result = get_running_pid(pid_file.strpath) assert result is None pid_file.write('abcdefg') result = get_running_pid(pid_file.strpath) assert result is None
def test_get_running_pid(tmpdir): """Assert function retrieves an integer from a given filename""" pid_file = tmpdir.join('sopel.pid') pid_file.write('7814') result = get_running_pid(pid_file.strpath) assert result == 7814
def test_get_running_pid_no_file(tmpdir): """Assert function returns None when there is no such file""" pid_file = tmpdir.join('sopel.pid') result = get_running_pid(pid_file.strpath) assert result is None