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
9ac6114d
Commit
9ac6114d
authored
May 13, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better test skipping, with message in the log.
parent
8c72b4e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
Lib/test/test_pep277.py
Lib/test/test_pep277.py
+14
-8
No files found.
Lib/test/test_pep277.py
View file @
9ac6114d
...
...
@@ -40,6 +40,18 @@ if sys.platform != 'darwin':
# NFKC(u'\u2001') == NFKC(u'\u2003')
])
# Is it Unicode-friendly?
if
not
os
.
path
.
supports_unicode_filenames
:
fsencoding
=
sys
.
getfilesystemencoding
()
or
sys
.
getdefaultencoding
()
try
:
for
name
in
filenames
:
name
.
encode
(
fsencoding
)
except
UnicodeEncodeError
:
raise
unittest
.
SkipTest
(
"only NT+ and systems with "
"Unicode-friendly filesystem encoding"
)
# Destroy directory dirname and all files under it, to one level.
def
deltree
(
dirname
):
# Don't hide legitimate errors: if one of these suckers exists, it's
...
...
@@ -63,14 +75,8 @@ class UnicodeFileTests(unittest.TestCase):
files
=
set
()
for
name
in
self
.
files
:
name
=
os
.
path
.
join
(
test_support
.
TESTFN
,
self
.
norm
(
name
))
try
:
f
=
open
(
name
,
'w'
)
except
UnicodeEncodeError
:
if
not
os
.
path
.
supports_unicode_filenames
:
self
.
skipTest
(
"only NT+ and systems with Unicode-friendly"
"filesystem encoding"
)
f
.
write
((
name
+
'
\
n
'
).
encode
(
"utf-8"
))
f
.
close
()
with
open
(
name
,
'w'
)
as
f
:
f
.
write
((
name
+
'
\
n
'
).
encode
(
"utf-8"
))
os
.
stat
(
name
)
files
.
add
(
name
)
self
.
files
=
files
...
...
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