]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_msvc9compiler.py
1 """Tests for distutils.msvc9compiler."""
6 from distutils
.errors
import DistutilsPlatformError
7 from distutils
.tests
import support
8 from test
.test_support
import run_unittest
11 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
12 <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
13 manifestVersion="1.0">
14 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
17 <requestedExecutionLevel level="asInvoker" uiAccess="false">
18 </requestedExecutionLevel>
19 </requestedPrivileges>
24 <assemblyIdentity type="win32" name="Microsoft.VC90.CRT"
25 version="9.0.21022.8" processorArchitecture="x86"
26 publicKeyToken="XXXX">
32 <assemblyIdentity type="win32" name="Microsoft.VC90.MFC"
33 version="9.0.21022.8" processorArchitecture="x86"
34 publicKeyToken="XXXX"></assemblyIdentity>
40 _CLEANED_MANIFEST
= """\
41 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42 <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
43 manifestVersion="1.0">
44 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
47 <requestedExecutionLevel level="asInvoker" uiAccess="false">
48 </requestedExecutionLevel>
49 </requestedPrivileges>
57 <assemblyIdentity type="win32" name="Microsoft.VC90.MFC"
58 version="9.0.21022.8" processorArchitecture="x86"
59 publicKeyToken="XXXX"></assemblyIdentity>
64 if sys
.platform
=="win32":
65 from distutils
.msvccompiler
import get_build_version
66 if get_build_version()>=8.0:
69 SKIP_MESSAGE
= "These tests are only for MSVC8.0 or above"
71 SKIP_MESSAGE
= "These tests are only for win32"
73 @unittest.skipUnless(SKIP_MESSAGE
is None, SKIP_MESSAGE
)
74 class msvc9compilerTestCase(support
.TempdirManager
,
77 def test_no_compiler(self
):
78 # makes sure query_vcvarsall throws
79 # a DistutilsPlatformError if the compiler
81 from distutils
.msvc9compiler
import query_vcvarsall
82 def _find_vcvarsall(version
):
85 from distutils
import msvc9compiler
86 old_find_vcvarsall
= msvc9compiler
.find_vcvarsall
87 msvc9compiler
.find_vcvarsall
= _find_vcvarsall
89 self
.assertRaises(DistutilsPlatformError
, query_vcvarsall
,
90 'wont find this version')
92 msvc9compiler
.find_vcvarsall
= old_find_vcvarsall
94 def test_reg_class(self
):
95 from distutils
.msvc9compiler
import Reg
96 self
.assertRaises(KeyError, Reg
.get_value
, 'xxx', 'xxx')
98 # looking for values that should exist on all
99 # windows registeries versions.
100 path
= r
'Control Panel\Desktop'
101 v
= Reg
.get_value(path
, u
'dragfullwindows')
102 self
.assertTrue(v
in (u
'0', u
'1', u
'2'))
105 HKCU
= _winreg
.HKEY_CURRENT_USER
106 keys
= Reg
.read_keys(HKCU
, 'xxxx')
107 self
.assertEqual(keys
, None)
109 keys
= Reg
.read_keys(HKCU
, r
'Control Panel')
110 self
.assertTrue('Desktop' in keys
)
112 def test_remove_visual_c_ref(self
):
113 from distutils
.msvc9compiler
import MSVCCompiler
114 tempdir
= self
.mkdtemp()
115 manifest
= os
.path
.join(tempdir
, 'manifest')
116 f
= open(manifest
, 'w')
122 compiler
= MSVCCompiler()
123 compiler
._remove
_visual
_c
_ref
(manifest
)
128 # removing trailing spaces
129 content
= '\n'.join([line
.rstrip() for line
in f
.readlines()])
133 # makes sure the manifest was properly cleaned
134 self
.assertEqual(content
, _CLEANED_MANIFEST
)
138 return unittest
.makeSuite(msvc9compilerTestCase
)
140 if __name__
== "__main__":
141 run_unittest(test_suite())