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

Unified Diff: Lib/distutils/tests/test_build_ext.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/distutils/sysconfig.py ('k') | Lib/distutils/tests/test_build_py.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/distutils/tests/test_build_ext.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/distutils/tests/test_build_ext.py Mon Jul 25 09:47:18 2011 -0400
@@ -11,8 +11,7 @@
from distutils.tests.support import LoggingSilencer
from distutils.extension import Extension
from distutils.errors import (
- CompileError, DistutilsPlatformError, DistutilsSetupError,
- UnknownFileError)
+ CompileError, DistutilsSetupError, UnknownFileError)
import unittest
from test import support
@@ -23,11 +22,6 @@
ALREADY_TESTED = False
def _get_source_filename():
- # use installed copy if available
- tests_f = os.path.join(os.path.dirname(__file__), 'xxmodule.c')
- if os.path.exists(tests_f):
- return tests_f
- # otherwise try using copy from build directory
srcdir = sysconfig.get_config_var('srcdir')
return os.path.join(srcdir, 'Modules', 'xxmodule.c')
@@ -432,43 +426,18 @@
@unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for MacOSX')
- def test_deployment_target_default(self):
- # Issue 9516: Test that, in the absence of the environment variable,
- # an extension module is compiled with the same deployment target as
- # the interpreter.
- self._try_compile_deployment_target('==', None)
+ def test_deployment_target(self):
+ self._try_compile_deployment_target()
- @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for MacOSX')
- def test_deployment_target_too_low(self):
- # Issue 9516: Test that an extension module is not allowed to be
- # compiled with a deployment target less than that of the interpreter.
- self.assertRaises(DistutilsPlatformError,
- self._try_compile_deployment_target, '>', '10.1')
-
- @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for MacOSX')
- def test_deployment_target_higher_ok(self):
- # Issue 9516: Test that an extension module can be compiled with a
- # deployment target higher than that of the interpreter: the ext
- # module may depend on some newer OS feature.
- deptarget = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
- if deptarget:
- # increment the minor version number (i.e. 10.6 -> 10.7)
- deptarget = [int(x) for x in deptarget.split('.')]
- deptarget[-1] += 1
- deptarget = '.'.join(str(i) for i in deptarget)
- self._try_compile_deployment_target('<', deptarget)
-
- def _try_compile_deployment_target(self, operator, target):
orig_environ = os.environ
os.environ = orig_environ.copy()
self.addCleanup(setattr, os, 'environ', orig_environ)
- if target is None:
- if os.environ.get('MACOSX_DEPLOYMENT_TARGET'):
- del os.environ['MACOSX_DEPLOYMENT_TARGET']
- else:
- os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
+ os.environ['MACOSX_DEPLOYMENT_TARGET']='10.1'
+ self._try_compile_deployment_target()
+
+ def _try_compile_deployment_target(self):
deptarget_c = os.path.join(self.tmp_dir, 'deptargetmodule.c')
with open(deptarget_c, 'w') as fp:
@@ -477,17 +446,16 @@
int dummy;
- #if TARGET %s MAC_OS_X_VERSION_MIN_REQUIRED
- #else
+ #if TARGET != MAC_OS_X_VERSION_MIN_REQUIRED
#error "Unexpected target"
#endif
- ''' % operator))
+ '''))
- # get the deployment target that the interpreter was built with
target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
target = tuple(map(int, target.split('.')))
target = '%02d%01d0' % target
+
deptarget_ext = Extension(
'deptarget',
[deptarget_c],
« no previous file with comments | « Lib/distutils/sysconfig.py ('k') | Lib/distutils/tests/test_build_py.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+