diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-04-07 21:16:56 +0100 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-04-07 21:16:56 +0100 |
| commit | 1bf18cc8573bf0faea6d5a7cd123f41e49287210 (patch) | |
| tree | 6ddd4fef25bc2f5704bf8ad840b8d8297b53ede3 | |
| parent | a31716f5a86061d7409b8c08154d3b52ff324efd (diff) | |
| parent | 3d8c2245cb09e0db917648f2cf57f99fd10caca1 (diff) | |
| download | python-setuptools-git-1bf18cc8573bf0faea6d5a7cd123f41e49287210.tar.gz | |
Merge pull request #532 from s-t-e-v-e-n-k/readd-exception-for-marker-eval
Reinstate the or guard in WorkingSet._markers_pass
| -rw-r--r-- | pkg_resources/__init__.py | 2 | ||||
| -rw-r--r-- | pkg_resources/tests/test_resources.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 08677719..c3e3e96c 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -861,7 +861,7 @@ class WorkingSet(object): result = [] if req in extra_req_mapping: - for extra in extra_req_mapping[req]: + for extra in extra_req_mapping[req] or ['']: result.append(req.marker.evaluate({'extra': extra})) else: result.append(req.marker.evaluate()) diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index 7f86c797..7907224e 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -186,6 +186,12 @@ class TestDistro: res = ws.resolve(parse_requirements("Foo;python_version>='2'"), ad) 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 + def test_marker_evaluation_with_extras(self): """Extras are also evaluated as markers at resolution time.""" ad = pkg_resources.Environment([]) |
