##// END OF EJS Templates
Backport PR #4019: Test skipping without unicode paths...
Backport PR #4019: Test skipping without unicode paths I somehow broke unicode in the terminal on this Debian box, and it revealed a load of tests that errored because they were trying to use non-ascii paths and commands. We already have a decorator for this, so I've scattered it around, and broken up a couple of tests into smaller chunks.

File last commit:

r6563:10f133e4
r12205:67de1b5e
Show More
test_openpy.py
23 lines | 803 B | text/x-python | PythonLexer
import io
import os.path
import nose.tools as nt
from IPython.utils import openpy
mydir = os.path.dirname(__file__)
nonascii_path = os.path.join(mydir, '../../core/tests/nonascii.py')
def test_detect_encoding():
f = open(nonascii_path, 'rb')
enc, lines = openpy.detect_encoding(f.readline)
nt.assert_equal(enc, 'iso-8859-5')
def test_read_file():
read_specified_enc = io.open(nonascii_path, encoding='iso-8859-5').read()
read_detected_enc = openpy.read_py_file(nonascii_path, skip_encoding_cookie=False)
nt.assert_equal(read_detected_enc, read_specified_enc)
assert u'coding: iso-8859-5' in read_detected_enc
read_strip_enc_cookie = openpy.read_py_file(nonascii_path, skip_encoding_cookie=True)
assert u'coding: iso-8859-5' not in read_strip_enc_cookie