Пример #1
0
def test_basic(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0, 100)}

    write_run_info(tmpdir, info)

    assert get_last_run_info(tmpdir, False) == info
Пример #2
0
def test_basic(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0,100)}

    write_run_info(tmpdir, info)

    assert get_last_run_info(tmpdir, False) == info
Пример #3
0
def test_lock_error(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0, 100)}

    with open(os.path.join(tmpdir, 'info.json.lock'), 'w') as lockfile:
        lockfile.write('locked!')

    with pytest.raises(FileLockException) as ex:
        write_run_info(tmpdir, info, timeout=1)

    assert ex is not None
Пример #4
0
def test_lock_error(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0,100)}

    with open(os.path.join(tmpdir, 'info.json.lock'), 'w') as lockfile:
        lockfile.write('locked!')

    with pytest.raises(FileLockException) as ex:
        write_run_info(tmpdir, info, timeout=1)

    assert ex is not None
Пример #5
0
def test_dryrun(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0, 100)}

    write_run_info(tmpdir, info)

    assert get_last_run_info(tmpdir, True) == info

    with open(os.path.join(tmpdir, 'info.json.lock'), 'w') as lockfile:
        lockfile.write('locked!')

    with pytest.raises(FileLockException) as ex:
        # Will fail if it doesn't throw
        assert get_last_run_info(tmpdir, True) is "fail"

    assert ex is not None
Пример #6
0
def test_dryrun(tmpdir):
    tmpdir = str(tmpdir)
    info = {'number': random.randint(0,100)}

    write_run_info(tmpdir, info)

    assert get_last_run_info(tmpdir, True) == info

    with open(os.path.join(tmpdir, 'info.json.lock'), 'w') as lockfile:
        lockfile.write('locked!')

    with pytest.raises(FileLockException) as ex:
        # Will fail if it doesn't throw
        assert get_last_run_info(tmpdir, True) is "fail"

    assert ex is not None