summaryrefslogtreecommitdiffstats
path: root/contrib/python/portalocker/py3/tests/temporary_file_lock.py
blob: b250bad6510cdb9837264f51a14c2b9e05f068fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
import portalocker


def test_temporary_file_lock(tmpfile):
    with portalocker.TemporaryFileLock(tmpfile):
        pass

    assert not os.path.isfile(tmpfile)

    lock = portalocker.TemporaryFileLock(tmpfile)
    lock.acquire()
    del lock