|
|
@ -18,6 +18,7 @@ try:
|
|
|
|
from cStringIO import StringIO
|
|
|
|
from cStringIO import StringIO
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
from io import StringIO
|
|
|
|
from io import StringIO
|
|
|
|
|
|
|
|
import locale
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import shutil
|
|
|
|
import tempfile
|
|
|
|
import tempfile
|
|
|
@ -273,10 +274,17 @@ class CommandLineTestCase(unittest.TestCase):
|
|
|
|
def test_run_non_ascii_file(self):
|
|
|
|
def test_run_non_ascii_file(self):
|
|
|
|
file = os.path.join(self.wd, 'non-ascii', 'utf-8')
|
|
|
|
file = os.path.join(self.wd, 'non-ascii', 'utf-8')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make sure the default localization conditions on this "system"
|
|
|
|
|
|
|
|
# support UTF-8 encoding.
|
|
|
|
|
|
|
|
loc = locale.getlocale()
|
|
|
|
|
|
|
|
locale.setlocale(locale.LC_ALL, 'C.UTF-8')
|
|
|
|
|
|
|
|
|
|
|
|
sys.stdout, sys.stderr = StringIO(), StringIO()
|
|
|
|
sys.stdout, sys.stderr = StringIO(), StringIO()
|
|
|
|
with self.assertRaises(SystemExit) as ctx:
|
|
|
|
with self.assertRaises(SystemExit) as ctx:
|
|
|
|
cli.run(('-f', 'parsable', file))
|
|
|
|
cli.run(('-f', 'parsable', file))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locale.setlocale(locale.LC_ALL, loc)
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(ctx.exception.code, 0)
|
|
|
|
self.assertEqual(ctx.exception.code, 0)
|
|
|
|
|
|
|
|
|
|
|
|
out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
|
|
|
|
out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
|
|
|
|