Skip to content

Commit

Permalink
fix test for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Micah Denbraver committed May 7, 2024
1 parent 84fda5b commit d71761d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_pip_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import tempfile
from pathlib import Path, PurePosixPath

import pytest

Expand All @@ -18,14 +19,20 @@ def repository():


def test_parse_requirements_preserve_editable_relative(repository):
test_package_path = os.path.join(PACKAGES_RELATIVE_PATH, "small_fake_a")
test_package_path = str(
PurePosixPath(Path(PACKAGES_RELATIVE_PATH)) / "small_fake_a"
)

with tempfile.NamedTemporaryFile("w") as infile:
infile = tempfile.NamedTemporaryFile("w", delete=False)
try:
infile.write(f"-e {test_package_path}")
infile.flush()
infile.close()

[install_requirement] = parse_requirements(
infile.name, session=repository.session
)
finally:
os.unlink(infile.name)

assert install_requirement.link.url == test_package_path
assert install_requirement.link.file_path == test_package_path

0 comments on commit d71761d

Please sign in to comment.