summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-05-19 22:37:40 -0400
committerJason R. Coombs <jaraco@jaraco.com>2013-05-19 22:37:40 -0400
commit25de5a1c0f475c3300e020ba2e3fa65f4864863c (patch)
tree4020e36cbe9e2478d0e8ed649cf544476ec82d46 /tests
parent8a98d526831347f522388e66ab56c245974fd71b (diff)
downloadpython-setuptools-bitbucket-25de5a1c0f475c3300e020ba2e3fa65f4864863c.tar.gz
Update doctest to use syntax suitable for Python 2 and Python 3. Credit to Lennart Regebro for the [hints in his book](http://python3porting.com/problems.html#handling-expected-exceptions).
Diffstat (limited to 'tests')
-rw-r--r--tests/api_tests.txt13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/api_tests.txt b/tests/api_tests.txt
index b5574021..06e14a33 100644
--- a/tests/api_tests.txt
+++ b/tests/api_tests.txt
@@ -208,11 +208,14 @@ You can ask a WorkingSet to ``find()`` a distribution matching a requirement::
Note that asking for a conflicting version of a distribution already in a
working set triggers a ``pkg_resources.VersionConflict`` error:
- >>> ws.find(Requirement.parse("Bar==1.0")) # doctest: +NORMALIZE_WHITESPACE
- Traceback (most recent call last):
- ...
- pkg_resources.VersionConflict: (Bar 0.9 (http://example.com/something),
- Requirement.parse('Bar==1.0'))
+ >>> try:
+ ... ws.find(Requirement.parse("Bar==1.0"))
+ ... except pkg_resources.VersionConflict:
+ ... exc = sys.exc_info()[1]
+ ... print(str(exc))
+ ... else:
+ ... raise AssertionError("VersionConflict was not raised")
+ (Bar 0.9 (http://examples.com/something), Requirement.parse('Bar==1.0'))
You can subscribe a callback function to receive notifications whenever a new
distribution is added to a working set. The callback is immediately invoked