1From 9934ce31b8447667f71c211e559a8de71e8263db Mon Sep 17 00:00:00 2001
2From: Brendan Molloy <brendan@bbqsrc.net>
3Date: Mon, 4 Jan 2016 23:14:06 +1100
4Subject: [PATCH] Check bytecode file actually exists and tests
5
6Should solve issue 20397, where using the --record argument results
7in files that failed to generate bytecode files are added to the
8record file nonetheless.
9---
10 Lib/distutils/command/install_lib.py    | 17 +++++++++++++----
11 Lib/distutils/tests/test_install_lib.py |  8 ++++++--
12 2 files changed, 19 insertions(+), 6 deletions(-)
13
14--- Lib/distutils/tests/test_install_lib.py.orig	2015-12-07 01:39:07 UTC
15+++ Lib/distutils/tests/test_install_lib.py
16@@ -64,11 +64,15 @@ class InstallLibTestCase(support.Tempdir
17         cmd.distribution.ext_modules = [Extension('foo', ['xxx'])]
18         cmd.distribution.packages = ['spam']
19         cmd.distribution.script_name = 'setup.py'
20+
21+        # Create rubbish, uncompilable file
22+        f = os.path.join(project_dir, 'spam', 'rubbish.py')
23+        self.write_file(f, 'rubbish()')
24
25         # get_outputs should return 4 elements: spam/__init__.py and .pyc,
26-        # foo.import-tag-abiflags.so / foo.pyd
27+        # foo.import-tag-abiflags.so / foo.pyd and rubbish.py (no .pyc)
28         outputs = cmd.get_outputs()
29-        self.assertEqual(len(outputs), 4, outputs)
30+        self.assertEqual(len(outputs), 5, outputs)
31
32     def test_get_inputs(self):
33         project_dir, dist = self.create_dist()
34