Skip to content

Commit

Permalink
Fix test_name_collision
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev authored and Madda committed May 26, 2020
1 parent 8124123 commit 7bb1002
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions tests/test_repository_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ def test_name_collision(from_line, pypi_repository, make_package, make_sdist, tm
}

for pkg_name, pkg in packages.items():
pkg_path = os.path.join(tmpdir, pkg_name)
os.mkdir(pkg_path)
pkg_path = str(tmpdir / pkg_name)

make_sdist(pkg, pkg_path, "--formats=zip")

Expand All @@ -376,20 +375,17 @@ def test_name_collision(from_line, pypi_repository, make_package, make_sdist, tm
os.path.join(pkg_path, "master.zip"),
)

name_collision_1 = (
"file://"
+ str(os.path.join(tmpdir, "test_package_1", "master.zip"))
+ "#egg=test_package_1"
name_collision_1 = "file://{dist_path}#egg=test_package_1".format(
dist_path=tmpdir / "test_package_1" / "master.zip"
)
ireq = from_line(name_collision_1)
pypi_repository.get_dependencies(ireq)
deps = pypi_repository.get_dependencies(ireq)
assert len(deps) == 0

name_collision_2 = (
"file://"
+ str(os.path.join(tmpdir, "test_package_2", "master.zip"))
+ "#egg=test_package_2"
name_collision_2 = "file://{dist_path}#egg=test_package_2".format(
dist_path=tmpdir / "test_package_2" / "master.zip"
)
ireq = from_line(name_collision_2)
reqs = pypi_repository.get_dependencies(ireq)
assert len(reqs) == 1
assert reqs.pop().req.name == "test-package-1"
deps = pypi_repository.get_dependencies(ireq)
assert len(deps) == 1
assert deps.pop().name == "test-package-1"

0 comments on commit 7bb1002

Please sign in to comment.