Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
30cc6546
Commit
30cc6546
authored
Oct 11, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Unicode handling in packaging’ check and register (#13114)
parent
794d567b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
Lib/packaging/tests/test_command_check.py
Lib/packaging/tests/test_command_check.py
+23
-2
Lib/packaging/tests/test_command_register.py
Lib/packaging/tests/test_command_register.py
+20
-8
No files found.
Lib/packaging/tests/test_command_check.py
View file @
30cc6546
...
...
@@ -56,6 +56,15 @@ class CheckTestCase(support.LoggingCatcher,
cmd
=
self
.
_run
(
metadata
,
strict
=
True
)
self
.
assertEqual
([],
self
.
get_logs
(
logging
.
WARNING
))
# now a test with non-ASCII characters
metadata
=
{
'home_page'
:
'xxx'
,
'author'
:
'
\
u00c9
ric'
,
'author_email'
:
'xxx'
,
'name'
:
'xxx'
,
'version'
:
'1.2'
,
'summary'
:
'Something about esszet
\
u00df
'
,
'description'
:
'More things about esszet
\
u00df
'
}
cmd
=
self
.
_run
(
metadata
)
self
.
assertEqual
([],
self
.
get_logs
(
logging
.
WARNING
))
def
test_check_metadata_1_2
(
self
):
# let's run the command with no metadata at all
# by default, check is checking the metadata
...
...
@@ -95,14 +104,26 @@ class CheckTestCase(support.LoggingCatcher,
@
unittest
.
skipUnless
(
_HAS_DOCUTILS
,
"requires docutils"
)
def
test_check_restructuredtext
(
self
):
# let's see if it detects broken rest in
long_
description
# let's see if it detects broken rest in description
broken_rest
=
'title
\
n
===
\
n
\
n
test'
pkg_info
,
dist
=
self
.
create_dist
(
description
=
broken_rest
)
cmd
=
check
(
dist
)
cmd
.
check_restructuredtext
()
self
.
assertEqual
(
len
(
self
.
get_logs
(
logging
.
WARNING
)),
1
)
# clear warnings from the previous call
self
.
loghandler
.
flush
()
# let's see if we have an error with strict=1
metadata
=
{
'home_page'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'xxx'
,
'name'
:
'xxx'
,
'version'
:
'1.2'
,
'description'
:
broken_rest
}
self
.
assertRaises
(
PackagingSetupError
,
self
.
_run
,
metadata
,
strict
=
True
,
all
=
True
)
self
.
loghandler
.
flush
()
pkg_info
,
dist
=
self
.
create_dist
(
description
=
'title
\
n
=====
\
n
\
n
test'
)
# and non-broken rest, including a non-ASCII character to test #12114
dist
=
self
.
create_dist
(
description
=
'title
\
n
=====
\
n
\
n
test
\
u00df
'
)[
1
]
cmd
=
check
(
dist
)
cmd
.
check_restructuredtext
()
self
.
assertEqual
([],
self
.
get_logs
(
logging
.
WARNING
))
...
...
Lib/packaging/tests/test_command_register.py
View file @
30cc6546
...
...
@@ -200,12 +200,10 @@ class RegisterTestCase(support.TempdirManager,
@
unittest
.
skipUnless
(
DOCUTILS_SUPPORT
,
'needs docutils'
)
def
test_strict
(
self
):
# testing the script option
# when on, the register command stops if
# the metadata is incomplete or if
# long_description is not reSt compliant
# testing the strict option: when on, the register command stops if the
# metadata is incomplete or if description contains bad reST
# empty metadata
# empty metadata
# XXX this is not really empty..
cmd
=
self
.
_get_cmd
({
'name'
:
'xxx'
,
'version'
:
'xxx'
})
cmd
.
ensure_finalized
()
cmd
.
strict
=
True
...
...
@@ -213,16 +211,15 @@ class RegisterTestCase(support.TempdirManager,
register_module
.
input
=
inputs
self
.
assertRaises
(
PackagingSetupError
,
cmd
.
run
)
# metadata is OK but
long_
description is broken
# metadata is OK but description is broken
metadata
=
{
'home_page'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'éxéxé'
,
'name'
:
'xxx'
,
'version'
:
'
xxx
'
,
'name'
:
'xxx'
,
'version'
:
'
4.2
'
,
'description'
:
'title
\
n
==
\
n
\
n
text'
}
cmd
=
self
.
_get_cmd
(
metadata
)
cmd
.
ensure_finalized
()
cmd
.
strict
=
True
self
.
assertRaises
(
PackagingSetupError
,
cmd
.
run
)
# now something that works
...
...
@@ -243,6 +240,21 @@ class RegisterTestCase(support.TempdirManager,
cmd
.
ensure_finalized
()
cmd
.
run
()
# and finally a Unicode test (bug #12114)
metadata
=
{
'home_page'
:
'xxx'
,
'author'
:
'
\
u00c9
ric'
,
'author_email'
:
'xxx'
,
'name'
:
'xxx'
,
'version'
:
'xxx'
,
'summary'
:
'Something about esszet
\
u00df
'
,
'description'
:
'More things about esszet
\
u00df
'
}
cmd
=
self
.
_get_cmd
(
metadata
)
cmd
.
ensure_finalized
()
cmd
.
strict
=
True
inputs
=
Inputs
(
'1'
,
'tarek'
,
'y'
)
register_module
.
input
=
inputs
cmd
.
ensure_finalized
()
cmd
.
run
()
def
test_register_pep345
(
self
):
cmd
=
self
.
_get_cmd
({})
cmd
.
ensure_finalized
()
...
...
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