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

Side by Side Diff: Lib/distutils/tests/test_msvc9compiler.py

Issue 19600: Use specific asserts in distutils tests
Patch Set: Created 5 years, 10 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:
View unified diff | Download patch
OLDNEW
1 """Tests for distutils.msvc9compiler.""" 1 """Tests for distutils.msvc9compiler."""
2 import sys 2 import sys
3 import unittest 3 import unittest
4 import os 4 import os
5 5
6 from distutils.errors import DistutilsPlatformError 6 from distutils.errors import DistutilsPlatformError
7 from distutils.tests import support 7 from distutils.tests import support
8 from test.support import run_unittest 8 from test.support import run_unittest
9 9
10 # A manifest with the only assembly reference being the msvcrt assembly, so 10 # A manifest with the only assembly reference being the msvcrt assembly, so
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 msvc9compiler.find_vcvarsall = old_find_vcvarsall 121 msvc9compiler.find_vcvarsall = old_find_vcvarsall
122 122
123 def test_reg_class(self): 123 def test_reg_class(self):
124 from distutils.msvc9compiler import Reg 124 from distutils.msvc9compiler import Reg
125 self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx') 125 self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')
126 126
127 # looking for values that should exist on all 127 # looking for values that should exist on all
128 # windows registeries versions. 128 # windows registeries versions.
129 path = r'Control Panel\Desktop' 129 path = r'Control Panel\Desktop'
130 v = Reg.get_value(path, 'dragfullwindows') 130 v = Reg.get_value(path, 'dragfullwindows')
131 self.assertTrue(v in ('0', '1', '2')) 131 self.assertIn(v, ('0', '1', '2'))
132 132
133 import winreg 133 import winreg
134 HKCU = winreg.HKEY_CURRENT_USER 134 HKCU = winreg.HKEY_CURRENT_USER
135 keys = Reg.read_keys(HKCU, 'xxxx') 135 keys = Reg.read_keys(HKCU, 'xxxx')
136 self.assertEqual(keys, None) 136 self.assertEqual(keys, None)
137 137
138 keys = Reg.read_keys(HKCU, r'Control Panel') 138 keys = Reg.read_keys(HKCU, r'Control Panel')
139 self.assertTrue('Desktop' in keys) 139 self.assertIn('Desktop', keys)
140 140
141 def test_remove_visual_c_ref(self): 141 def test_remove_visual_c_ref(self):
142 from distutils.msvc9compiler import MSVCCompiler 142 from distutils.msvc9compiler import MSVCCompiler
143 tempdir = self.mkdtemp() 143 tempdir = self.mkdtemp()
144 manifest = os.path.join(tempdir, 'manifest') 144 manifest = os.path.join(tempdir, 'manifest')
145 f = open(manifest, 'w') 145 f = open(manifest, 'w')
146 try: 146 try:
147 f.write(_MANIFEST_WITH_MULTIPLE_REFERENCES) 147 f.write(_MANIFEST_WITH_MULTIPLE_REFERENCES)
148 finally: 148 finally:
149 f.close() 149 f.close()
(...skipping 17 matching lines...) Expand all
167 tempdir = self.mkdtemp() 167 tempdir = self.mkdtemp()
168 manifest = os.path.join(tempdir, 'manifest') 168 manifest = os.path.join(tempdir, 'manifest')
169 f = open(manifest, 'w') 169 f = open(manifest, 'w')
170 try: 170 try:
171 f.write(_MANIFEST_WITH_ONLY_MSVC_REFERENCE) 171 f.write(_MANIFEST_WITH_ONLY_MSVC_REFERENCE)
172 finally: 172 finally:
173 f.close() 173 f.close()
174 174
175 compiler = MSVCCompiler() 175 compiler = MSVCCompiler()
176 got = compiler._remove_visual_c_ref(manifest) 176 got = compiler._remove_visual_c_ref(manifest)
177 self.assertIs(got, None) 177 self.assertIsNone(got)
178 178
179 179
180 def test_suite(): 180 def test_suite():
181 return unittest.makeSuite(msvc9compilerTestCase) 181 return unittest.makeSuite(msvc9compilerTestCase)
182 182
183 if __name__ == "__main__": 183 if __name__ == "__main__":
184 run_unittest(test_suite()) 184 run_unittest(test_suite())
OLDNEW

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