| 
									
										
										
										
											2007-12-08 15:34:59 +00:00
										 |  |  | """Tests for distutils.dist.""" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from distutils import sysconfig | 
					
						
							|  |  |  | import os | 
					
						
							|  |  |  | import unittest | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-20 21:35:26 +00:00
										 |  |  | from test.support import TESTFN | 
					
						
							| 
									
										
										
										
											2007-12-08 15:34:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class SysconfigTestCase(unittest.TestCase): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_get_config_h_filename(self): | 
					
						
							|  |  |  |         config_h = sysconfig.get_config_h_filename() | 
					
						
							|  |  |  |         self.assert_(os.path.isfile(config_h), config_h) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_get_python_lib(self): | 
					
						
							|  |  |  |         lib_dir = sysconfig.get_python_lib() | 
					
						
							| 
									
										
											  
											
												Merged revisions 59488-59511 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r59489 | christian.heimes | 2007-12-14 03:33:57 +0100 (Fri, 14 Dec 2007) | 1 line
  Silence a warning about an unsed variable in debug builds
........
  r59490 | christian.heimes | 2007-12-14 03:35:23 +0100 (Fri, 14 Dec 2007) | 2 lines
  Fixed bug #1620: New @spam.getter property syntax modifies the property in place.
  I added also the feature that a @prop.getter decorator does not overwrite the doc string of the property if it was given as an argument to property().
........
  r59491 | raymond.hettinger | 2007-12-14 03:49:47 +0100 (Fri, 14 Dec 2007) | 1 line
  Cleaner method naming convention
........
  r59492 | christian.heimes | 2007-12-14 04:02:34 +0100 (Fri, 14 Dec 2007) | 1 line
  Fixed a warning in _codecs_iso2022.c and some non C89 conform // comments.
........
  r59493 | christian.heimes | 2007-12-14 05:38:13 +0100 (Fri, 14 Dec 2007) | 1 line
  Fixed warning in ssl module
........
  r59500 | raymond.hettinger | 2007-12-14 19:08:20 +0100 (Fri, 14 Dec 2007) | 1 line
  Add line spacing for readability
........
  r59501 | raymond.hettinger | 2007-12-14 19:12:21 +0100 (Fri, 14 Dec 2007) | 3 lines
  Update method names for named tuples.
........
  r59503 | georg.brandl | 2007-12-14 20:03:36 +0100 (Fri, 14 Dec 2007) | 3 lines
  Add a section about nested listcomps to the tutorial.
  Thanks to Ian Bruntlett and Robert Lehmann.
........
  r59504 | raymond.hettinger | 2007-12-14 20:19:59 +0100 (Fri, 14 Dec 2007) | 1 line
  Faster and simpler _replace() method
........
  r59505 | raymond.hettinger | 2007-12-14 22:51:50 +0100 (Fri, 14 Dec 2007) | 1 line
  Add usage note
........
  r59507 | andrew.kuchling | 2007-12-14 23:41:18 +0100 (Fri, 14 Dec 2007) | 1 line
  Remove warning about URL
........
  r59510 | andrew.kuchling | 2007-12-14 23:52:36 +0100 (Fri, 14 Dec 2007) | 1 line
  Bump the version number, and make a few small edits
........
  r59511 | christian.heimes | 2007-12-15 00:42:36 +0100 (Sat, 15 Dec 2007) | 2 lines
  Fixed bug #1628
  The detection now works on Unix with Makefile, Makefile with VPATH and on Windows.
........
											
										 
											2007-12-15 01:27:15 +00:00
										 |  |  |         # XXX doesn't work on Linux when Python was never installed before | 
					
						
							| 
									
										
										
										
											2007-12-08 15:34:59 +00:00
										 |  |  |         #self.assert_(os.path.isdir(lib_dir), lib_dir) | 
					
						
							|  |  |  |         # test for pythonxx.lib? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_get_python_inc(self): | 
					
						
							| 
									
										
										
										
											2008-04-07 00:25:59 +00:00
										 |  |  |         # The check for srcdir is copied from Python's setup.py, | 
					
						
							|  |  |  |         # and is necessary to make this test pass when building | 
					
						
							|  |  |  |         # Python in a directory other than the source directory. | 
					
						
							|  |  |  |         (srcdir,) = sysconfig.get_config_vars('srcdir') | 
					
						
							|  |  |  |         if not srcdir: | 
					
						
							|  |  |  |             inc_dir = sysconfig.get_python_inc() | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             # This test is not really a proper test: when building | 
					
						
							|  |  |  |             # Python from source, even in the same directory, | 
					
						
							|  |  |  |             # we won't be testing the same thing as when running | 
					
						
							|  |  |  |             # distutils' tests on an installed Python. Nevertheless, | 
					
						
							|  |  |  |             # let's try to do our best: if we are running Python's | 
					
						
							|  |  |  |             # unittests from a build directory that is not the source | 
					
						
							|  |  |  |             # directory, the normal inc_dir will exist, it will just not | 
					
						
							|  |  |  |             # contain anything of interest. | 
					
						
							|  |  |  |             inc_dir = sysconfig.get_python_inc() | 
					
						
							|  |  |  |             self.assert_(os.path.isdir(inc_dir)) | 
					
						
							|  |  |  |             # Now test the source location, to make sure Python.h does | 
					
						
							|  |  |  |             # exist. | 
					
						
							|  |  |  |             inc_dir = os.path.join(os.getcwd(), srcdir, 'Include') | 
					
						
							|  |  |  |             inc_dir = os.path.normpath(inc_dir) | 
					
						
							| 
									
										
										
										
											2007-12-08 15:34:59 +00:00
										 |  |  |         self.assert_(os.path.isdir(inc_dir), inc_dir) | 
					
						
							|  |  |  |         python_h = os.path.join(inc_dir, "Python.h") | 
					
						
							|  |  |  |         self.assert_(os.path.isfile(python_h), python_h) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_get_config_vars(self): | 
					
						
							|  |  |  |         cvars = sysconfig.get_config_vars() | 
					
						
							|  |  |  |         self.assert_(isinstance(cvars, dict)) | 
					
						
							|  |  |  |         self.assert_(cvars) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_suite(): | 
					
						
							|  |  |  |     suite = unittest.TestSuite() | 
					
						
							|  |  |  |     suite.addTest(unittest.makeSuite(SysconfigTestCase)) | 
					
						
							|  |  |  |     return suite |