aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/tests/test_resources.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-04-07 22:05:20 +0100
committerJason R. Coombs <jaraco@jaraco.com>2016-04-07 22:05:20 +0100
commitbe663b8596fc3e3d02cb5716db1d638788a0230e (patch)
treec9501af52a4f80a523e701a4e4ebca9721a343de /pkg_resources/tests/test_resources.py
parent1bf18cc8573bf0faea6d5a7cd123f41e49287210 (diff)
downloadexternal_python_setuptools-be663b8596fc3e3d02cb5716db1d638788a0230e.tar.gz
external_python_setuptools-be663b8596fc3e3d02cb5716db1d638788a0230e.tar.bz2
external_python_setuptools-be663b8596fc3e3d02cb5716db1d638788a0230e.zip
Extract _ReqExtras to encapsulate that functionality and decouple it from WorkingSet.
Diffstat (limited to 'pkg_resources/tests/test_resources.py')
-rw-r--r--pkg_resources/tests/test_resources.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 7907224e..acc8dc1e 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -187,10 +187,25 @@ class TestDistro:
assert list(res) == [Foo]
def test_environment_marker_evaluation_called(self):
- ws = WorkingSet([])
- req, = parse_requirements("bar;python_version<'4'")
- extra_req_mapping = {req: ()}
- assert ws._markers_pass(req, extra_req_mapping) == True
+ """
+ If one package foo requires bar without any extras,
+ markers should pass for bar.
+ """
+ parent_req, = parse_requirements("foo")
+ req, = parse_requirements("bar;python_version>='2'")
+ req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
+ assert req_extras.markers_pass(req)
+
+ parent_req, = parse_requirements("foo[]")
+ req, = parse_requirements("bar;python_version>='2'")
+ req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
+ assert req_extras.markers_pass(req)
+
+ # this is a little awkward; I would want this to fail
+ parent_req, = parse_requirements("foo")
+ req, = parse_requirements("bar;python_version>='2' and extra==''")
+ req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
+ assert req_extras.markers_pass(req)
def test_marker_evaluation_with_extras(self):
"""Extras are also evaluated as markers at resolution time."""