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
5e9051a6
Commit
5e9051a6
authored
Dec 21, 2013
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Plain Diff
Issue #20045: Fix "setup.py register --list-classifiers".
parents
95d828bc
c2c0846c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
6 deletions
+25
-6
command/register.py
command/register.py
+4
-1
tests/support.py
tests/support.py
+4
-3
tests/test_register.py
tests/test_register.py
+17
-2
No files found.
command/register.py
View file @
5e9051a6
...
...
@@ -5,6 +5,7 @@ Implements the Distutils 'register' command (register with the repository).
# created 2002/10/21, Richard Jones
import
cgi
import
os
,
string
,
getpass
import
io
import
urllib.parse
,
urllib
.
request
...
...
@@ -87,7 +88,9 @@ class register(PyPIRCCommand):
'''
url
=
self
.
repository
+
'?:action=list_classifiers'
response
=
urllib
.
request
.
urlopen
(
url
)
log
.
info
(
response
.
read
())
content_type
=
response
.
getheader
(
'content-type'
,
'text/plain'
)
encoding
=
cgi
.
parse_header
(
content_type
)[
1
].
get
(
'charset'
,
'ascii'
)
log
.
info
(
response
.
read
().
decode
(
encoding
))
def
verify_metadata
(
self
):
''' Send the metadata to the package index server to be checked.
...
...
tests/support.py
View file @
5e9051a6
...
...
@@ -32,14 +32,15 @@ class LoggingSilencer(object):
def
_log
(
self
,
level
,
msg
,
args
):
if
level
not
in
(
DEBUG
,
INFO
,
WARN
,
ERROR
,
FATAL
):
raise
ValueError
(
'%s wrong log level'
%
str
(
level
))
if
not
isinstance
(
msg
,
str
):
raise
TypeError
(
"msg should be str, not '%.200s'"
%
(
type
(
msg
).
__name__
))
self
.
logs
.
append
((
level
,
msg
,
args
))
def
get_logs
(
self
,
*
levels
):
def
_format
(
msg
,
args
):
if
len
(
args
)
==
0
:
return
msg
return
msg
%
args
return
[
_format
(
msg
,
args
)
for
level
,
msg
,
args
return
[
msg
%
args
for
level
,
msg
,
args
in
self
.
logs
if
level
in
levels
]
def
clear_logs
(
self
):
...
...
tests/test_register.py
View file @
5e9051a6
...
...
@@ -10,6 +10,7 @@ from test.support import check_warnings, run_unittest
from
distutils.command
import
register
as
register_module
from
distutils.command.register
import
register
from
distutils.errors
import
DistutilsSetupError
from
distutils.log
import
INFO
from
distutils.tests.test_config
import
PyPIRCCommandTestCase
...
...
@@ -58,12 +59,18 @@ class FakeOpener(object):
def
__call__
(
self
,
*
args
):
return
self
def
open
(
self
,
req
):
def
open
(
self
,
req
,
data
=
None
,
timeout
=
None
):
self
.
reqs
.
append
(
req
)
return
self
def
read
(
self
):
return
'xxx'
return
b'xxx'
def
getheader
(
self
,
name
,
default
=
None
):
return
{
'content-type'
:
'text/plain; charset=utf-8'
,
}.
get
(
name
.
lower
(),
default
)
class
RegisterTestCase
(
PyPIRCCommandTestCase
):
...
...
@@ -285,6 +292,14 @@ class RegisterTestCase(PyPIRCCommandTestCase):
cmd
.
check_metadata
()
self
.
assertEqual
(
len
(
w
.
warnings
),
1
)
def
test_list_classifiers
(
self
):
cmd
=
self
.
_get_cmd
()
cmd
.
list_classifiers
=
1
cmd
.
run
()
results
=
self
.
get_logs
(
INFO
)
self
.
assertEqual
(
results
,
[
'running check'
,
'xxx'
])
def
test_suite
():
return
unittest
.
makeSuite
(
RegisterTestCase
)
...
...
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