Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4086)

Delta Between Two Patch Sets: Lib/distutils/tests/test_install.py

Issue 12678: test_packaging and test_distutils failures under Windows
Left Patch Set: Created 1 year, 9 months ago
Right Patch Set: Created 1 year, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/distutils/tests/test_build_ext.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 """Tests for distutils.command.install.""" 1 """Tests for distutils.command.install."""
2 2
3 import os 3 import os
4 import sys 4 import sys
5 import unittest 5 import unittest
6 import site 6 import site
7 7
8 from test.support import captured_stdout, run_unittest 8 from test.support import captured_stdout, run_unittest
9 9
10 from distutils import sysconfig 10 from distutils import sysconfig
11 from distutils.command.install import install 11 from distutils.command.install import install
12 from distutils.command import install as install_module 12 from distutils.command import install as install_module
13 from distutils.command.build_ext import build_ext 13 from distutils.command.build_ext import build_ext
14 from distutils.command.install import INSTALL_SCHEMES 14 from distutils.command.install import INSTALL_SCHEMES
15 from distutils.core import Distribution 15 from distutils.core import Distribution
16 from distutils.errors import DistutilsOptionError 16 from distutils.errors import DistutilsOptionError
17 from distutils.extension import Extension 17 from distutils.extension import Extension
18 18
19 from distutils.tests import support 19 from distutils.tests import support
20 20
21 21
22 def _make_ext_name(modname): 22 def _make_ext_name(modname):
23 if os.name == 'nt': 23 if os.name == 'nt':
24 modname += '_d' 24 if sys.executable.endswith('_d.exe'):
25 modname += '_d'
25 return modname + sysconfig.get_config_var('SO') 26 return modname + sysconfig.get_config_var('SO')
26 27
27 28
28 class InstallTestCase(support.TempdirManager, 29 class InstallTestCase(support.TempdirManager,
29 support.EnvironGuard, 30 support.EnvironGuard,
30 support.LoggingSilencer, 31 support.LoggingSilencer,
31 unittest.TestCase): 32 unittest.TestCase):
32 33
33 def test_home_installation_scheme(self): 34 def test_home_installation_scheme(self):
34 # This ensure two things: 35 # This ensure two things:
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 self.assertEqual(found, expected) 202 self.assertEqual(found, expected)
202 203
203 def test_record_extensions(self): 204 def test_record_extensions(self):
204 install_dir = self.mkdtemp() 205 install_dir = self.mkdtemp()
205 project_dir, dist = self.create_dist(ext_modules=[ 206 project_dir, dist = self.create_dist(ext_modules=[
206 Extension('xx', ['xxmodule.c'])]) 207 Extension('xx', ['xxmodule.c'])])
207 self.addCleanup(os.chdir, os.getcwd()) 208 self.addCleanup(os.chdir, os.getcwd())
208 os.chdir(project_dir) 209 os.chdir(project_dir)
209 support.copy_xxmodule_c(project_dir) 210 support.copy_xxmodule_c(project_dir)
210 211
211 buildcmd = build_ext(dist) 212 buildextcmd = build_ext(dist)
212 support.fixup_build_ext(buildcmd) 213 support.fixup_build_ext(buildextcmd)
213 buildcmd.ensure_finalized() 214 buildextcmd.ensure_finalized()
214 buildcmd.run()
215 215
216 cmd = install(dist) 216 cmd = install(dist)
217 dist.command_obj['install'] = cmd 217 dist.command_obj['install'] = cmd
218 dist.command_obj['build_ext'] = buildextcmd
218 cmd.root = install_dir 219 cmd.root = install_dir
219 cmd.record = os.path.join(project_dir, 'RECORD') 220 cmd.record = os.path.join(project_dir, 'RECORD')
220 cmd.ensure_finalized() 221 cmd.ensure_finalized()
221 cmd.run() 222 cmd.run()
222 223
223 f = open(cmd.record) 224 f = open(cmd.record)
224 try: 225 try:
225 content = f.read() 226 content = f.read()
226 finally: 227 finally:
227 f.close() 228 f.close()
(...skipping 12 matching lines...) Expand all
240 self.test_record() 241 self.test_record()
241 finally: 242 finally:
242 install_module.DEBUG = False 243 install_module.DEBUG = False
243 self.assertTrue(len(self.logs) > old_logs_len) 244 self.assertTrue(len(self.logs) > old_logs_len)
244 245
245 def test_suite(): 246 def test_suite():
246 return unittest.makeSuite(InstallTestCase) 247 return unittest.makeSuite(InstallTestCase)
247 248
248 if __name__ == "__main__": 249 if __name__ == "__main__":
249 run_unittest(test_suite()) 250 run_unittest(test_suite())
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7