summaryrefslogtreecommitdiff
path: root/tests/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-17 16:06:16 +0000
committerNed Batchelder <ned@nedbatchelder.com>2016-11-17 16:06:16 +0000
commit929297eef803362c3b6156751e81b2d84e5ff4c4 (patch)
treeb080839032a47608a9cc823d4732eeb49c71ed25 /tests/test_process.py
parentaf724468a47be24056d684ce836251124c052f19 (diff)
downloadpython-coveragepy-git-929297eef803362c3b6156751e81b2d84e5ff4c4.tar.gz
Don't collapse in an ascii-only file-world. #533
Diffstat (limited to 'tests/test_process.py')
-rw-r--r--tests/test_process.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_process.py b/tests/test_process.py
index aa2045fd..62b6dc83 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -721,6 +721,23 @@ class ProcessTest(CoverageTest):
# about 5.
self.assertGreater(data.line_counts()['os.py'], 50)
+ def test_lang_c(self):
+ # LANG=C forces getfilesystemencoding on Linux to 'ascii', which causes
+ # failures with non-ascii file names. We don't want to make a real file
+ # with strange characters, though, because that gets the test runners
+ # tangled up. This will isolate the concerns to the coverage.py code.
+ # https://bitbucket.org/ned/coveragepy/issues/533/exception-on-unencodable-file-name
+ self.make_file("weird_file.py", r"""
+ globs = {}
+ code = "a = 1\nb = 2\n"
+ exec(compile(code, "wut\xe9\xea\xeb\xec\x01\x02.py", 'exec'), globs)
+ print(globs['a'])
+ print(globs['b'])
+ """)
+ self.set_environ("LANG", "C")
+ out = self.run_command("python -m coverage run weird_file.py")
+ self.assertEqual(out, "1\n2\n")
+
def test_deprecation_warnings(self):
# Test that coverage doesn't trigger deprecation warnings.
# https://bitbucket.org/ned/coveragepy/issue/305/pendingdeprecationwarning-the-imp-module