Commit e65d621e authored by Vinay Sajip's avatar Vinay Sajip

Fixed some bugs - tests now all pass under Python 3.3.

--HG--
branch : distribute
extra : rebase_source : 3498bfdc0d4c15e4276673b52e924c461ca353f0
parent 58a658b2
...@@ -16,7 +16,7 @@ if sys.version_info[0] < 3: ...@@ -16,7 +16,7 @@ if sys.version_info[0] < 3:
import httplib import httplib
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler from SimpleHTTPServer import SimpleHTTPRequestHandler
iteritems = lambda o: o.iteritems iteritems = lambda o: o.iteritems()
long_type = long long_type = long
maxsize = sys.maxint maxsize = sys.maxint
next = lambda o: o.next() next = lambda o: o.next()
...@@ -55,7 +55,7 @@ else: ...@@ -55,7 +55,7 @@ else:
from html.entities import name2codepoint from html.entities import name2codepoint
import http.client as httplib import http.client as httplib
from http.server import HTTPServer, SimpleHTTPRequestHandler from http.server import HTTPServer, SimpleHTTPRequestHandler
iteritems = lambda o: o.items iteritems = lambda o: o.items()
long_type = int long_type = int
maxsize = sys.maxsize maxsize = sys.maxsize
next = next next = next
......
...@@ -6,7 +6,7 @@ import os, shutil, tempfile, unittest ...@@ -6,7 +6,7 @@ import os, shutil, tempfile, unittest
import pkg_resources import pkg_resources
from setuptools.compat import urllib2, httplib, HTTPError from setuptools.compat import urllib2, httplib, HTTPError
import setuptools.package_index import setuptools.package_index
from tests.server import IndexServer from setuptools.tests.server import IndexServer
class TestPackageIndex(unittest.TestCase): class TestPackageIndex(unittest.TestCase):
......
...@@ -39,7 +39,7 @@ Distributions have various introspectable attributes:: ...@@ -39,7 +39,7 @@ Distributions have various introspectable attributes::
>>> dist.py_version == sys.version[:3] >>> dist.py_version == sys.version[:3]
True True
>>> print dist.platform >>> print(dist.platform)
None None
Including various computed attributes:: Including various computed attributes::
...@@ -199,7 +199,7 @@ shows up once when iterating the working set: ...@@ -199,7 +199,7 @@ shows up once when iterating the working set:
You can ask a WorkingSet to ``find()`` a distribution matching a requirement:: You can ask a WorkingSet to ``find()`` a distribution matching a requirement::
>>> from pkg_resources import Requirement >>> from pkg_resources import Requirement
>>> print ws.find(Requirement.parse("Foo==1.0")) # no match, return None >>> print(ws.find(Requirement.parse("Foo==1.0"))) # no match, return None
None None
>>> ws.find(Requirement.parse("Bar==0.9")) # match, return distribution >>> ws.find(Requirement.parse("Bar==0.9")) # match, return distribution
...@@ -211,7 +211,7 @@ working set triggers a ``pkg_resources.VersionConflict`` error: ...@@ -211,7 +211,7 @@ working set triggers a ``pkg_resources.VersionConflict`` error:
>>> try: >>> try:
... ws.find(Requirement.parse("Bar==1.0")) ... ws.find(Requirement.parse("Bar==1.0"))
... except VersionConflict: ... except VersionConflict:
... print 'ok' ... print('ok')
ok ok
You can subscribe a callback function to receive notifications whenever a new You can subscribe a callback function to receive notifications whenever a new
...@@ -219,7 +219,7 @@ distribution is added to a working set. The callback is immediately invoked ...@@ -219,7 +219,7 @@ distribution is added to a working set. The callback is immediately invoked
once for each existing distribution in the working set, and then is called once for each existing distribution in the working set, and then is called
again for new distributions added thereafter:: again for new distributions added thereafter::
>>> def added(dist): print "Added", dist >>> def added(dist): print("Added", dist)
>>> ws.subscribe(added) >>> ws.subscribe(added)
Added Bar 0.9 Added Bar 0.9
>>> foo12 = Distribution(project_name="Foo", version="1.2", location="f12") >>> foo12 = Distribution(project_name="Foo", version="1.2", location="f12")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment