summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-08-20 05:08:51 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-08-20 05:08:51 (GMT)
commit17725410850094241d459bce50ac1e8f416cfa63 (patch)
tree36db69d277948a095bd8f3d58bc4a993f3d89219 /Lib/distutils
parent9358bfdaffe513e2604764bf1b2f72a59f495555 (diff)
downloadcpython-17725410850094241d459bce50ac1e8f416cfa63.zip
cpython-17725410850094241d459bce50ac1e8f416cfa63.tar.gz
cpython-17725410850094241d459bce50ac1e8f416cfa63.tar.bz2
Add a test for extension modules in the distutils record file.
I made a note a month ago that install --record wrote incorrect entries for extension modules (I think the problem was that the first character of the file was stripped), so I’m now adding a test to try to reproduce that in the current versions.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/tests/test_install.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 3e47d81..2133fa7 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -7,11 +7,14 @@ import site
from test.support import captured_stdout, run_unittest
+from distutils import sysconfig
from distutils.command.install import install
from distutils.command import install as install_module
+from distutils.command.build_ext import build_ext
from distutils.command.install import INSTALL_SCHEMES
from distutils.core import Distribution
from distutils.errors import DistutilsOptionError
+from distutils.extension import Extension
from distutils.tests import support
@@ -190,6 +193,36 @@ class InstallTestCase(support.TempdirManager,
'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
self.assertEqual(found, expected)
+ def test_record_extensions(self):
+ install_dir = self.mkdtemp()
+ project_dir, dist = self.create_dist(ext_modules=[
+ Extension('xx', ['xxmodule.c'])])
+ self.addCleanup(os.chdir, os.getcwd())
+ os.chdir(project_dir)
+ support.copy_xxmodule_c(project_dir)
+
+ buildcmd = build_ext(dist)
+ buildcmd.ensure_finalized()
+ buildcmd.run()
+
+ cmd = install(dist)
+ dist.command_obj['install'] = cmd
+ cmd.root = install_dir
+ cmd.record = os.path.join(project_dir, 'RECORD')
+ cmd.ensure_finalized()
+ cmd.run()
+
+ f = open(cmd.record)
+ try:
+ content = f.read()
+ finally:
+ f.close()
+
+ found = [os.path.basename(line) for line in content.splitlines()]
+ expected = ['xx%s' % sysconfig.get_config_var('SO'),
+ 'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
+ self.assertEqual(found, expected)
+
def test_debug_mode(self):
# this covers the code called when DEBUG is set
old_logs_len = len(self.logs)