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

Delta Between Two Patch Sets: Lib/test/test_sysconfig.py

Issue 16510: Using appropriate checks in tests
Left Patch Set: Created 5 years, 10 months ago
Right Patch Set: Created 5 years, 7 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_symtable.py ('k') | Lib/test/test_sys.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import unittest 1 import unittest
2 import sys 2 import sys
3 import os 3 import os
4 import subprocess 4 import subprocess
5 import shutil 5 import shutil
6 from copy import copy 6 from copy import copy
7 7
8 from test.support import (run_unittest, TESTFN, unlink, 8 from test.support import (run_unittest, TESTFN, unlink, check_warnings,
9 captured_stdout, skip_unless_symlink) 9 captured_stdout, skip_unless_symlink)
10 10
11 import sysconfig 11 import sysconfig
12 from sysconfig import (get_paths, get_platform, get_config_vars, 12 from sysconfig import (get_paths, get_platform, get_config_vars,
13 get_path, get_path_names, _INSTALL_SCHEMES, 13 get_path, get_path_names, _INSTALL_SCHEMES,
14 _get_default_scheme, _expand_vars, 14 _get_default_scheme, _expand_vars,
15 get_scheme_names, get_config_var, _main) 15 get_scheme_names, get_config_var, _main)
16 import _osx_support 16 import _osx_support
17 17
18 class TestSysConfig(unittest.TestCase): 18 class TestSysConfig(unittest.TestCase):
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 # See Issues #15322, #15364. 362 # See Issues #15322, #15364.
363 srcdir = sysconfig.get_config_var('srcdir') 363 srcdir = sysconfig.get_config_var('srcdir')
364 cwd = os.getcwd() 364 cwd = os.getcwd()
365 try: 365 try:
366 os.chdir('..') 366 os.chdir('..')
367 srcdir2 = sysconfig.get_config_var('srcdir') 367 srcdir2 = sysconfig.get_config_var('srcdir')
368 finally: 368 finally:
369 os.chdir(cwd) 369 os.chdir(cwd)
370 self.assertEqual(srcdir, srcdir2) 370 self.assertEqual(srcdir, srcdir2)
371 371
372 @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
373 'EXT_SUFFIX required for this test')
374 def test_SO_deprecation(self):
375 self.assertWarns(DeprecationWarning,
376 sysconfig.get_config_var, 'SO')
377
378 @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
379 'EXT_SUFFIX required for this test')
380 def test_SO_value(self):
381 with check_warnings(('', DeprecationWarning)):
382 self.assertEqual(sysconfig.get_config_var('SO'),
383 sysconfig.get_config_var('EXT_SUFFIX'))
384
385 @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
386 'EXT_SUFFIX required for this test')
387 def test_SO_in_vars(self):
388 vars = sysconfig.get_config_vars()
389 self.assertIsNotNone(vars['SO'])
390 self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
391
372 392
373 class MakefileTests(unittest.TestCase): 393 class MakefileTests(unittest.TestCase):
374 394
375 @unittest.skipIf(sys.platform.startswith('win'), 395 @unittest.skipIf(sys.platform.startswith('win'),
376 'Test is not Windows compatible') 396 'Test is not Windows compatible')
377 def test_get_makefile_filename(self): 397 def test_get_makefile_filename(self):
378 makefile = sysconfig.get_makefile_filename() 398 makefile = sysconfig.get_makefile_filename()
379 self.assertTrue(os.path.isfile(makefile), makefile) 399 self.assertTrue(os.path.isfile(makefile), makefile)
380 400
381 def test_parse_makefile(self): 401 def test_parse_makefile(self):
(...skipping 12 matching lines...) Expand all
394 'var4': '$/invalid', 414 'var4': '$/invalid',
395 'var5': 'dollar$5', 415 'var5': 'dollar$5',
396 }) 416 })
397 417
398 418
399 def test_main(): 419 def test_main():
400 run_unittest(TestSysConfig, MakefileTests) 420 run_unittest(TestSysConfig, MakefileTests)
401 421
402 if __name__ == "__main__": 422 if __name__ == "__main__":
403 test_main() 423 test_main()
LEFTRIGHT

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