コード例 #1
0
ファイル: test_cli_run.py プロジェクト: r4f4/sopel
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
コード例 #2
0
ファイル: test_cli_run.py プロジェクト: r4f4/sopel
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
コード例 #3
0
ファイル: test_cli_run.py プロジェクト: r4f4/sopel
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