Example #1
0
def test_acquire_lock(tmpdir):
    locked_file = tmpdir.join("locked_file")
    locked_file.write("")

    path = "%s" % locked_file

    assert store.have_lock(path) == False
    store.aquire_lock(path)
    assert store.have_lock(path) == True
Example #2
0
def test_release_all_locks(tmpdir):
    locked_file1 = tmpdir.join("locked_file1")
    locked_file1.write("")
    locked_file2 = tmpdir.join("locked_file2")
    locked_file2.write("")

    path1 = "%s" % locked_file1
    path2 = "%s" % locked_file2

    assert store.have_lock(path1) == False
    store.aquire_lock(path1)
    assert store.have_lock(path1) == True

    assert store.have_lock(path2) == False
    store.aquire_lock(path2)
    assert store.have_lock(path2) == True

    store.release_all_locks()
    assert store.have_lock(path1) == False
    assert store.have_lock(path2) == False
Example #3
0
def test_acquire_lock_not_existing(tmpdir):
    store.aquire_lock("%s/asd" % tmpdir)