summaryrefslogtreecommitdiff
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-04 13:00:50 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-04 13:00:50 -0500
commit880ccea0220509bfaf483a50beefc128299a5b03 (patch)
treeb2a83ebaf50947034066a226b55bc7616eb24209 /pkg_resources
parent06b95e98f06916ccbd04b60e9d3866e3d6bf7ae2 (diff)
downloadpython-setuptools-git-880ccea0220509bfaf483a50beefc128299a5b03.tar.gz
Add test for WorkingSet.find() when a conflict occurs.
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/tests/test_resources.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index cf16bf03..79961e6c 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -205,6 +205,22 @@ class TestDistro:
d.requires(["foo"])
+class TestWorkingSet:
+ def test_find_conflicting(self):
+ ws = WorkingSet([])
+ Foo = Distribution.from_filename("/foo_dir/Foo-1.2.egg")
+ ws.add(Foo)
+
+ # create a requirement that conflicts with Foo 1.2
+ req = next(parse_requirements("Foo<1.2"))
+
+ with pytest.raises(VersionConflict) as vc:
+ ws.find(req)
+
+ msg = 'Foo 1.2 is installed but Foo<1.2 is required'
+ assert str(vc).endswith(msg)
+
+
class TestEntryPoints:
def assertfields(self, ep):