Skip to content

Instantly share code, notes, and snippets.

@asvetlov
Created November 3, 2012 12:30
Show Gist options
  • Save asvetlov/4007236 to your computer and use it in GitHub Desktop.
Save asvetlov/4007236 to your computer and use it in GitHub Desktop.
def test_non_utf8(self):
# Issue #16218
with temp_dir() as script_dir:
script_basename = '\u0441\u043a\u0440\u0438\u043f\u0442'
try:
script_basename.encode(sys.getfilesystemencoding())
except UnicodeEncodeError:
raise unittest.SkipTest("Filesystem doesn't support "
"unicode names")
source = 'print("test output")\n'
script_name = make_script(script_dir, script_basename, source)
importlib.invalidate_caches()
if not __debug__:
run_args = ('-' + 'O' * sys.flags.optimize, script_name)
else:
run_args = (script_name,)
rc, out, _ = assert_python_ok(*run_args)
self.assertEqual(0, rc)
self.assertEqual(b"test output\n", out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment