Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
4ae4faeb
Commit
4ae4faeb
authored
Dec 01, 2013
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved imports to the top, made them compatible with Python 2, and added a docstring.
parent
a87729f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
setuptools/compat.py
setuptools/compat.py
+2
-2
setuptools/tests/test_packageindex.py
setuptools/tests/test_packageindex.py
+6
-4
No files found.
setuptools/compat.py
View file @
4ae4faeb
...
@@ -27,7 +27,7 @@ if sys.version_info[0] < 3:
...
@@ -27,7 +27,7 @@ if sys.version_info[0] < 3:
unichr
=
unichr
unichr
=
unichr
unicode
=
unicode
unicode
=
unicode
bytes
=
str
bytes
=
str
from
urllib
import
url2pathname
,
splittag
from
urllib
import
url2pathname
,
splittag
,
pathname2url
import
urllib2
import
urllib2
from
urllib2
import
urlopen
,
HTTPError
,
URLError
,
unquote
,
splituser
from
urllib2
import
urlopen
,
HTTPError
,
URLError
,
unquote
,
splituser
from
urlparse
import
urlparse
,
urlunparse
,
urljoin
,
urlsplit
,
urlunsplit
from
urlparse
import
urlparse
,
urlunparse
,
urljoin
,
urlsplit
,
urlunsplit
...
@@ -73,7 +73,7 @@ else:
...
@@ -73,7 +73,7 @@ else:
bytes
=
bytes
bytes
=
bytes
from
urllib.error
import
HTTPError
,
URLError
from
urllib.error
import
HTTPError
,
URLError
import
urllib.request
as
urllib2
import
urllib.request
as
urllib2
from
urllib.request
import
urlopen
,
url2pathname
from
urllib.request
import
urlopen
,
url2pathname
,
pathname2url
from
urllib.parse
import
(
from
urllib.parse
import
(
urlparse
,
urlunparse
,
unquote
,
splituser
,
urljoin
,
urlsplit
,
urlparse
,
urlunparse
,
unquote
,
splituser
,
urljoin
,
urlsplit
,
urlunsplit
,
splittag
,
urlunsplit
,
splittag
,
...
...
setuptools/tests/test_packageindex.py
View file @
4ae4faeb
"""Package Index Tests
"""Package Index Tests
"""
"""
import
sys
import
sys
import
os
import
unittest
import
unittest
import
pkg_resources
import
pkg_resources
from
setuptools.compat
import
urllib2
,
httplib
,
HTTPError
,
unicode
from
setuptools.compat
import
urllib2
,
httplib
,
HTTPError
,
unicode
,
pathname2url
import
distutils.errors
import
distutils.errors
import
setuptools.package_index
import
setuptools.package_index
from
setuptools.tests.server
import
IndexServer
from
setuptools.tests.server
import
IndexServer
...
@@ -152,13 +153,14 @@ class TestPackageIndex(unittest.TestCase):
...
@@ -152,13 +153,14 @@ class TestPackageIndex(unittest.TestCase):
self
.
assertEqual
(
rev
,
'2995'
)
self
.
assertEqual
(
rev
,
'2995'
)
def
test_local_index
(
self
):
def
test_local_index
(
self
):
"""
local_open should be able to read an index from the file system.
"""
f
=
open
(
'index.html'
,
'w'
)
f
=
open
(
'index.html'
,
'w'
)
f
.
write
(
'<div>content</div>'
)
f
.
write
(
'<div>content</div>'
)
f
.
close
()
f
.
close
()
try
:
try
:
import
urllib.request
url
=
'file:'
+
pathname2url
(
os
.
getcwd
())
+
'/'
import
os
url
=
'file:'
+
urllib
.
request
.
pathname2url
(
os
.
getcwd
())
+
'/'
res
=
setuptools
.
package_index
.
local_open
(
url
)
res
=
setuptools
.
package_index
.
local_open
(
url
)
finally
:
finally
:
os
.
remove
(
'index.html'
)
os
.
remove
(
'index.html'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment