Skip to content

Commit

Permalink
Merge pull request #601 from maresb/fix-591
Browse files Browse the repository at this point in the history
Save mock private pypi package to temp directory
  • Loading branch information
maresb authored Feb 10, 2024
2 parents d06fa35 + 394e716 commit 265715a
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions tests/test_pip_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,17 @@
</html>
"""

_PRIVATE_PACKAGE_SDIST_PATH = (
Path(__file__).parent / "test-pip-repositories" / "fake-private-package-1.0.0"
)


@pytest.fixture(scope="module")
def private_package_tar():
tar_path = _PRIVATE_PACKAGE_SDIST_PATH.parent / "fake-private-package-1.0.0.tar.gz"
@pytest.fixture
def private_package_tar(tmp_path: Path):
sdist_path = (
clone_test_dir("test-pip-repositories", tmp_path) / "fake-private-package-1.0.0"
)
assert sdist_path.exists()
tar_path = sdist_path / "fake-private-package-1.0.0.tar.gz"
with tarfile.open(tar_path, "w:gz") as tar:
tar.add(
_PRIVATE_PACKAGE_SDIST_PATH,
arcname=os.path.basename(_PRIVATE_PACKAGE_SDIST_PATH),
)
try:
yield tar_path
finally:
os.remove(tar_path)
tar.add(sdist_path, arcname=os.path.basename(sdist_path))
return tar_path


@pytest.fixture(
Expand Down

0 comments on commit 265715a

Please sign in to comment.