Skip to content

Commit 073f759

Browse files
author
Victor Stinner
committed
Move non-ascii test from test_run_code() to a new function: test_non_ascii()
1 parent f6211ed commit 073f759

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Lib/test/test_cmd_line.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,16 @@ def test_run_code(self):
9999
# All good if execution is successful
100100
assert_python_ok('-c', 'pass')
101101

102+
@unittest.skipIf(sys.getfilesystemencoding() == 'ascii',
103+
'need a filesystem encoding different than ASCII')
104+
def test_non_ascii(self):
102105
# Test handling of non-ascii data
103-
if sys.getfilesystemencoding() != 'ascii':
104-
if test.support.verbose:
105-
import locale
106-
print('locale encoding = %s, filesystem encoding = %s'
107-
% (locale.getpreferredencoding(), sys.getfilesystemencoding()))
108-
command = "assert(ord('\xe9') == 0xe9)"
109-
assert_python_ok('-c', command)
106+
if test.support.verbose:
107+
import locale
108+
print('locale encoding = %s, filesystem encoding = %s'
109+
% (locale.getpreferredencoding(), sys.getfilesystemencoding()))
110+
command = "assert(ord('\xe9') == 0xe9)"
111+
assert_python_ok('-c', command)
110112

111113
# On Windows, pass bytes to subprocess doesn't test how Python decodes the
112114
# command line, but how subprocess does decode bytes to unicode. Python

0 commit comments

Comments
 (0)