summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-17 07:04:03 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-11-17 07:04:03 -0500
commit724dba8e31ca636a120a71c3cc74449ef470a5e1 (patch)
treeb9ce43cfec45aefe02c0d642230ea953e230f1cc /tests/test_api.py
parent1321b30a93a684a5f4773fcc7940538192d1a929 (diff)
downloadpython-coveragepy-724dba8e31ca636a120a71c3cc74449ef470a5e1.tar.gz
Add a test for #533
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 6f14210..1018ff0 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -100,6 +100,16 @@ class ApiTest(CoverageTest):
filename, _, _, _ = cov.analysis(sys.modules["mymod"])
self.assertEqual(os.path.basename(filename), "mymod.py")
+ def test_unencodable_filename(self):
+ code = """a = 1\nb = 2\n"""
+ cov = coverage.Coverage()
+ cov.start()
+ globs = {}
+ exec(compile(code, "wut\xe9\xea\xeb\xec\x01\x02.py", 'exec'), globs)
+ cov.stop()
+ self.assertEqual(globs['a'], 1)
+ self.assertEqual(globs['b'], 2)
+
def test_ignore_stdlib(self):
self.make_file("mymain.py", """\
import colorsys