Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid race conditions in tests using the demo_pkg_inline fixture #2986

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2985.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid race conditions in tests using the ``demo_pkg_inline`` fixture.
7 changes: 5 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from _pytest.monkeypatch import MonkeyPatch # cannot import from tox.pytest yet
from _pytest.tmpdir import TempPathFactory
from distlib.scripts import ScriptMaker
from filelock import FileLock
from pytest_mock import MockerFixture
from virtualenv import cli_run

Expand Down Expand Up @@ -77,8 +78,10 @@ def demo_pkg_setuptools() -> Path:


@pytest.fixture(scope="session")
def demo_pkg_inline() -> Path:
return HERE / "demo_pkg_inline"
def demo_pkg_inline() -> Iterator[Path]:
demo_path = HERE / "demo_pkg_inline"
with FileLock(f"{demo_path}.lock"):
yield demo_path


@pytest.fixture()
Expand Down