summaryrefslogtreecommitdiff
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-04 14:24:22 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-04 14:24:22 -0500
commitcdb9797a1107afd4d7baf021b2af84946d349a2a (patch)
treed4782854c459b8198f9870339a7dafc45feffc62 /pkg_resources
parent72e3a1ce5986c54fed71da1f65aed4022008511f (diff)
downloadpython-setuptools-git-cdb9797a1107afd4d7baf021b2af84946d349a2a.tar.gz
Add test capturing expectation when dependencies conflict during resolve. Fixes #281
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/tests/test_resources.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 13ed4eb1..7ba65786 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -222,6 +222,31 @@ class TestWorkingSet:
msg = 'Foo 1.2 is installed but Foo<1.2 is required'
assert vc.value.report() == msg
+ def test_resolve_conflicts_with_prior(self):
+ """
+ A ContextualVersionConflict should be raised when a requirement
+ conflicts with a prior requirement for a different package.
+ """
+ # Create installation where Foo depends on Baz 1.0 and Bar depends on
+ # Baz 2.0.
+ ws = WorkingSet([])
+ md = Metadata(('depends.txt', "Baz==1.0"))
+ Foo = Distribution.from_filename("/foo_dir/Foo-1.0.egg", metadata=md)
+ ws.add(Foo)
+ md = Metadata(('depends.txt', "Baz==2.0"))
+ Bar = Distribution.from_filename("/foo_dir/Bar-1.0.egg", metadata=md)
+ ws.add(Bar)
+ Baz = Distribution.from_filename("/foo_dir/Baz-1.0.egg")
+ ws.add(Baz)
+ Baz = Distribution.from_filename("/foo_dir/Baz-2.0.egg")
+ ws.add(Baz)
+
+ with pytest.raises(VersionConflict) as vc:
+ ws.resolve(parse_requirements("Foo\nBar\n"))
+
+ msg = "Baz 1.0 is installed but Baz==2.0 is required by {'Bar'}"
+ assert vc.value.report() == msg
+
class TestEntryPoints: