Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bohuslav Kabrda <bkabrda@redhat.com>
Date: Wed, 30 Oct 2013 10:50:01 +0100
Subject: [PATCH] 00186: Fix for
 https://bugzilla.redhat.com/show_bug.cgi?id=1023607

Previously, this fixed a problem where some *.py files were not being
bytecompiled properly during build. This was result of py_compile.compile
raising exception when trying to convert test file with bad encoding, and
thus not continuing bytecompilation for other files.
This was fixed upstream, but the test hasn't been merged yet, so we keep it
---
 Lib/test/test_py_compile.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index 4a6caa5718..bf67e36a72 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -69,6 +69,10 @@ class PyCompileTests(unittest.TestCase):
         self.assertTrue(os.path.exists(self.pyc_path))
         self.assertFalse(os.path.exists(self.cache_path))
 
+    def test_bad_coding(self):
+        bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
+        self.assertIsNone(py_compile.compile(bad_coding, doraise=False))
+
     def test_relative_path(self):
         py_compile.compile(os.path.relpath(self.source_path),
                            os.path.relpath(self.pyc_path))