Skip to content

Commit b74a776

Browse files
committed
Merge branch 'bugfix/280-test' into bugfix/280-unique-distributions
2 parents 35bc403 + 8935288 commit b74a776

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_api.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@ def test_entry_points_distribution(self):
7676
self.assertIn(ep.dist.name, ('distinfo-pkg', 'egginfo-pkg'))
7777
self.assertEqual(ep.dist.version, "1.0.0")
7878

79+
def test_entry_points_unique_packages(self):
80+
"""
81+
Entry points should only be exposed for the first package
82+
on sys.path with a given name.
83+
"""
84+
alt_site_dir = self.fixtures.enter_context(fixtures.tempdir())
85+
self.fixtures.enter_context(self.add_sys_path(alt_site_dir))
86+
alt_pkg = {
87+
"distinfo_pkg-1.1.0.dist-info": {
88+
"METADATA": """
89+
Name: distinfo-pkg
90+
Version: 1.1.0
91+
""",
92+
"entry_points.txt": """
93+
[entries]
94+
main = mod:altmain
95+
""",
96+
},
97+
}
98+
fixtures.build_files(alt_pkg, alt_site_dir)
99+
entries = dict(entry_points()['entries'])
100+
assert not any(
101+
ep.dist.name == 'distinfo-pkg' and ep.dist.version == '1.0.0'
102+
for ep in entries.values()
103+
)
104+
# ns:sub doesn't exist in alt_pkg
105+
assert 'ns:sub' not in entries
106+
79107
def test_metadata_for_this_package(self):
80108
md = metadata('egginfo-pkg')
81109
assert md['author'] == 'Steven Ma'

0 commit comments

Comments
 (0)