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
commitaf724468a47be24056d684ce836251124c052f19 (patch)
treec2d7c47aa2af9e0c7270745cc70987662d61bae3 /tests/test_api.py
parent9d2391ce9abf0d57ee42626b42aae49c78740c12 (diff)
downloadpython-coveragepy-git-af724468a47be24056d684ce836251124c052f19.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 6f142100..1018ff09 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