aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_packageindex.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-12-01 06:08:30 -0500
committerJason R. Coombs <jaraco@jaraco.com>2013-12-01 06:08:30 -0500
commit4ae4faeb1262435260ee8a5f2a0ab910fe96ea23 (patch)
treeea69a2b8a86eaba4ba9d5000228e5ff78c92477b /setuptools/tests/test_packageindex.py
parenta87729f8b64b95cc203ae8e71fc6b5150725e1e7 (diff)
downloadexternal_python_setuptools-4ae4faeb1262435260ee8a5f2a0ab910fe96ea23.tar.gz
external_python_setuptools-4ae4faeb1262435260ee8a5f2a0ab910fe96ea23.tar.bz2
external_python_setuptools-4ae4faeb1262435260ee8a5f2a0ab910fe96ea23.zip
Moved imports to the top, made them compatible with Python 2, and added a docstring.
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r--setuptools/tests/test_packageindex.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 5a0c3946..664566a3 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -1,9 +1,10 @@
"""Package Index Tests
"""
import sys
+import os
import unittest
import pkg_resources
-from setuptools.compat import urllib2, httplib, HTTPError, unicode
+from setuptools.compat import urllib2, httplib, HTTPError, unicode, pathname2url
import distutils.errors
import setuptools.package_index
from setuptools.tests.server import IndexServer
@@ -152,13 +153,14 @@ class TestPackageIndex(unittest.TestCase):
self.assertEqual(rev, '2995')
def test_local_index(self):
+ """
+ local_open should be able to read an index from the file system.
+ """
f = open('index.html', 'w')
f.write('<div>content</div>')
f.close()
try:
- import urllib.request
- import os
- url = 'file:' + urllib.request.pathname2url(os.getcwd()) + '/'
+ url = 'file:' + pathname2url(os.getcwd()) + '/'
res = setuptools.package_index.local_open(url)
finally:
os.remove('index.html')