]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_build.py
1 """Tests for distutils.command.build."""
5 from test
.test_support
import run_unittest
7 from distutils
.command
.build
import build
8 from distutils
.tests
import support
9 from sysconfig
import get_platform
11 class BuildTestCase(support
.TempdirManager
,
12 support
.LoggingSilencer
,
15 def test_finalize_options(self
):
16 pkg_dir
, dist
= self
.create_dist()
18 cmd
.finalize_options()
20 # if not specified, plat_name gets the current platform
21 self
.assertEqual(cmd
.plat_name
, get_platform())
23 # build_purelib is build + lib
24 wanted
= os
.path
.join(cmd
.build_base
, 'lib')
25 self
.assertEqual(cmd
.build_purelib
, wanted
)
27 # build_platlib is 'build/lib.platform-x.x[-pydebug]'
29 # build/lib.macosx-10.3-i386-2.7
30 plat_spec
= '.%s-%s' % (cmd
.plat_name
, sys
.version
[0:3])
31 if hasattr(sys
, 'gettotalrefcount'):
32 self
.assertTrue(cmd
.build_platlib
.endswith('-pydebug'))
33 plat_spec
+= '-pydebug'
34 wanted
= os
.path
.join(cmd
.build_base
, 'lib' + plat_spec
)
35 self
.assertEqual(cmd
.build_platlib
, wanted
)
37 # by default, build_lib = build_purelib
38 self
.assertEqual(cmd
.build_lib
, cmd
.build_purelib
)
40 # build_temp is build/temp.<plat>
41 wanted
= os
.path
.join(cmd
.build_base
, 'temp' + plat_spec
)
42 self
.assertEqual(cmd
.build_temp
, wanted
)
44 # build_scripts is build/scripts-x.x
45 wanted
= os
.path
.join(cmd
.build_base
, 'scripts-' + sys
.version
[0:3])
46 self
.assertEqual(cmd
.build_scripts
, wanted
)
48 # executable is os.path.normpath(sys.executable)
49 self
.assertEqual(cmd
.executable
, os
.path
.normpath(sys
.executable
))
52 return unittest
.makeSuite(BuildTestCase
)
54 if __name__
== "__main__":
55 run_unittest(test_suite())