Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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