# Path: pgctl/flock.py
# @contextmanager
# def flock(file_or_dir, **acquire_args):
#     """A context for flock.acquire()."""
#     fd = None
#     while fd is None:
#         fd = acquire(file_or_dir, **acquire_args)
#     try:
#         yield fd
#     finally:
#         os.close(fd)


from pytest import fixture
from testfixtures import ShouldRaise
from pgctl.flock import flock
        from os.path import exists
        from pgctl.subprocess import Popen
        import os.path



@fixture
def tmpfile(tmpdir):
    tmpfile = tmpdir.join('tmpfile')
    assert not tmpfile.exists()
    yield tmpfile.strpath


def assert_locked(tmpfile):

# Path: pgctl/flock.py
# @contextmanager
# def flock(file_or_dir, **acquire_args):
#     """A context for flock.acquire()."""
#     fd = None
#     while fd is None:
#         fd = acquire(file_or_dir, **acquire_args)
#     try:
#         yield fd
#     finally:
#         os.close(fd)


# Path: tests/unit/flock.py
from pytest import fixture
from testfixtures import ShouldRaise
from pgctl.flock import flock
        from os.path import exists
        from pgctl.subprocess import Popen
        import os.path




@fixture
def tmpfile(tmpdir):
    tmpfile = tmpdir.join('tmpfile')
    assert not tmpfile.exists()
    yield tmpfile.strpath


def assert_locked(tmpfile):

    with ShouldRaise(flock.Locked(tmpfile)):