diff options
| author | ?ric Araujo <merwok@netwok.org> | 2011-09-19 02:45:27 +0200 |
|---|---|---|
| committer | ?ric Araujo <merwok@netwok.org> | 2011-09-19 02:45:27 +0200 |
| commit | bacdb3036d4dc80bc89e5769cbde8eb25fafe582 (patch) | |
| tree | e553093ed705bc0a6f7f00b92b5e210fc0cb27f1 /distutils2/tests | |
| parent | bc476f04af383f7f4d8624a813dc918077b0fce0 (diff) | |
| download | disutils2-bacdb3036d4dc80bc89e5769cbde8eb25fafe582.tar.gz | |
Add a test for extension modules in the old-style record file
Diffstat (limited to 'distutils2/tests')
| -rw-r--r-- | distutils2/tests/test_command_install_dist.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/distutils2/tests/test_command_install_dist.py b/distutils2/tests/test_command_install_dist.py index 1598106..5207188 100644 --- a/distutils2/tests/test_command_install_dist.py +++ b/distutils2/tests/test_command_install_dist.py @@ -3,7 +3,9 @@ import os import sys +from distutils2.command.build_ext import build_ext from distutils2.command.install_dist import install_dist +from distutils2.compiler.extension import Extension from distutils2.dist import Distribution from distutils2.errors import PackagingOptionError @@ -15,6 +17,12 @@ from distutils2._backport.sysconfig import ( _CONFIG_VARS = get_config_vars() +def _make_ext_name(modname): + if os.name == 'nt' and sys.executable.endswith('_d.exe'): + modname += '_d' + return modname + get_config_var('SO') + + class InstallTestCase(support.TempdirManager, support.LoggingCatcher, unittest.TestCase): @@ -199,6 +207,39 @@ class InstallTestCase(support.TempdirManager, # XXX test that fancy_getopt is okay with options named # record and no-record but unrelated + @unittest.skipIf(sys.version_info[:2] < (2, 6), + "can't compile xxmodule successfully") + def test_old_record_extensions(self): + # test pre-PEP 376 --record option with ext modules + install_dir = self.mkdtemp() + project_dir, dist = self.create_dist(ext_modules=[ + Extension('xx', ['xxmodule.c'])]) + os.chdir(project_dir) + support.copy_xxmodule_c(project_dir) + + buildextcmd = build_ext(dist) + support.fixup_build_ext(buildextcmd) + buildextcmd.ensure_finalized() + + cmd = install_dist(dist) + dist.command_obj['install_dist'] = cmd + dist.command_obj['build_ext'] = buildextcmd + cmd.root = install_dir + cmd.record = os.path.join(project_dir, 'filelist') + 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 = [_make_ext_name('xx'), + 'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD'] + self.assertEqual(found, expected) + def test_suite(): return unittest.makeSuite(InstallTestCase) |
