aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/tests/test_resources.py
diff options
context:
space:
mode:
authorGabi Davar <grizzly.nyo@gmail.com>2016-07-30 16:52:11 +0300
committerGabi Davar <grizzly.nyo@gmail.com>2016-08-23 11:58:21 +0300
commit452e13ce06ca0cdebebc61c9326a2db184095353 (patch)
treeaacb9e0df7094b7abe51f4ee195cea1f70b9d698 /pkg_resources/tests/test_resources.py
parent1aa71905fc9bd9a13f2b0c371e869ae8eb27308c (diff)
downloadexternal_python_setuptools-452e13ce06ca0cdebebc61c9326a2db184095353.tar.gz
external_python_setuptools-452e13ce06ca0cdebebc61c9326a2db184095353.tar.bz2
external_python_setuptools-452e13ce06ca0cdebebc61c9326a2db184095353.zip
fix for extra names containing '-'
Diffstat (limited to 'pkg_resources/tests/test_resources.py')
-rw-r--r--pkg_resources/tests/test_resources.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 2ed56233..3b13884b 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -221,6 +221,24 @@ class TestDistro:
res = list(ws.resolve(parse_requirements("Foo[baz]"), ad))
assert res == [Foo, quux]
+ def test_marker_evaluation_with_extras_normlized(self):
+ """Extras are also evaluated as markers at resolution time."""
+ ad = pkg_resources.Environment([])
+ ws = WorkingSet([])
+ # Metadata needs to be native strings due to cStringIO behaviour in
+ # 2.6, so use str().
+ Foo = Distribution.from_filename(
+ "/foo_dir/Foo-1.2.dist-info",
+ metadata=Metadata(("METADATA", str("Provides-Extra: baz-lightyear\n"
+ "Requires-Dist: quux; extra=='baz-lightyear'")))
+ )
+ ad.add(Foo)
+ assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
+ quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
+ ad.add(quux)
+ res = list(ws.resolve(parse_requirements("Foo[baz-lightyear]"), ad))
+ assert res == [Foo, quux]
+
def test_marker_evaluation_with_multiple_extras(self):
ad = pkg_resources.Environment([])
ws = WorkingSet([])