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
af6c7d71
Commit
af6c7d71
authored
Jun 11, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport test_getfilesystemencoding() from py3k
Note: On Python 3.1, file system encoding can be None.
parent
cd097d7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
Lib/test/test_sys.py
Lib/test/test_sys.py
+30
-0
No files found.
Lib/test/test_sys.py
View file @
af6c7d71
...
...
@@ -792,6 +792,36 @@ class SizeofTest(unittest.TestCase):
# sys.flags
check
(
sys
.
flags
,
size
(
vh
)
+
self
.
P
*
len
(
sys
.
flags
))
def
test_getfilesystemencoding
(
self
):
import
codecs
def
check_fsencoding
(
fs_encoding
):
if
sys
.
platform
==
'darwin'
:
self
.
assertEqual
(
fs_encoding
,
'utf-8'
)
elif
fs_encoding
is
None
:
return
codecs
.
lookup
(
fs_encoding
)
fs_encoding
=
sys
.
getfilesystemencoding
()
check_fsencoding
(
fs_encoding
)
# Even in C locale
try
:
sys
.
executable
.
encode
(
'ascii'
)
except
UnicodeEncodeError
:
# Python doesn't start with ASCII locale if its path is not ASCII,
# see issue #8611
pass
else
:
env
=
os
.
environ
.
copy
()
env
[
'LANG'
]
=
'C'
output
=
subprocess
.
check_output
(
[
sys
.
executable
,
"-c"
,
"import sys; print(sys.getfilesystemencoding())"
],
env
=
env
)
fs_encoding
=
output
.
rstrip
().
decode
(
'ascii'
)
check_fsencoding
(
fs_encoding
)
def
test_setfilesystemencoding
(
self
):
old
=
sys
.
getfilesystemencoding
()
try
:
...
...
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