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

Side by Side Diff: Lib/test/test_platform.py

Issue 16510: Using appropriate checks in 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
« no previous file with comments | « Lib/test/test_pep380.py ('k') | Lib/test/test_posix.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from unittest import mock 1 from unittest import mock
2 import os 2 import os
3 import platform 3 import platform
4 import subprocess 4 import subprocess
5 import sys 5 import sys
6 import tempfile 6 import tempfile
7 import unittest 7 import unittest
8 import warnings 8 import warnings
9 9
10 from test import support 10 from test import support
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if platform.uname().system == 'Darwin': 190 if platform.uname().system == 'Darwin':
191 # We're on a MacOSX system, check that 191 # We're on a MacOSX system, check that
192 # the right version information is returned 192 # the right version information is returned
193 fd = os.popen('sw_vers', 'r') 193 fd = os.popen('sw_vers', 'r')
194 real_ver = None 194 real_ver = None
195 for ln in fd: 195 for ln in fd:
196 if ln.startswith('ProductVersion:'): 196 if ln.startswith('ProductVersion:'):
197 real_ver = ln.strip().split()[-1] 197 real_ver = ln.strip().split()[-1]
198 break 198 break
199 fd.close() 199 fd.close()
200 self.assertFalse(real_ver is None) 200 self.assertIsNotNone(real_ver)
201 result_list = res[0].split('.') 201 result_list = res[0].split('.')
202 expect_list = real_ver.split('.') 202 expect_list = real_ver.split('.')
203 len_diff = len(result_list) - len(expect_list) 203 len_diff = len(result_list) - len(expect_list)
204 # On Snow Leopard, sw_vers reports 10.6.0 as 10.6 204 # On Snow Leopard, sw_vers reports 10.6.0 as 10.6
205 if len_diff > 0: 205 if len_diff > 0:
206 expect_list.extend(['0'] * len_diff) 206 expect_list.extend(['0'] * len_diff)
207 self.assertEqual(result_list, expect_list) 207 self.assertEqual(result_list, expect_list)
208 208
209 # res[1] claims to contain 209 # res[1] claims to contain
210 # (version, dev_stage, non_release_version) 210 # (version, dev_stage, non_release_version)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 self.assertEqual(version, '19') 311 self.assertEqual(version, '19')
312 self.assertEqual(distid, 'Schr\xf6dinger\u2019s Cat') 312 self.assertEqual(distid, 'Schr\xf6dinger\u2019s Cat')
313 313
314 def test_main(): 314 def test_main():
315 support.run_unittest( 315 support.run_unittest(
316 PlatformTest 316 PlatformTest
317 ) 317 )
318 318
319 if __name__ == '__main__': 319 if __name__ == '__main__':
320 test_main() 320 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_pep380.py ('k') | Lib/test/test_posix.py » ('j') | no next file with comments »

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