Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: pylib/gyp/MSVSSettings_test.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Unit tests for the MSVSSettings.py file.""" 7 """Unit tests for the MSVSSettings.py file."""
8 8
9 import StringIO 9 try:
10 from StringIO import StringIO
11 except ImportError:
12 from io import StringIO
Nico 2016/07/29 22:22:05 Isn't the recommended pattern "try py3 way, and if
AWhetter 2016/11/05 23:59:49 You're right. I've fixed this on my github.
10 import unittest 13 import unittest
11 import gyp.MSVSSettings as MSVSSettings 14 import gyp.MSVSSettings as MSVSSettings
12 15
13 16
14 class TestSequenceFunctions(unittest.TestCase): 17 class TestSequenceFunctions(unittest.TestCase):
15 18
16 def setUp(self): 19 def setUp(self):
17 self.stderr = StringIO.StringIO() 20 self.stderr = StringIO()
18 21
19 def _ExpectedWarnings(self, expected): 22 def _ExpectedWarnings(self, expected):
20 """Compares recorded lines to expected warnings.""" 23 """Compares recorded lines to expected warnings."""
21 self.stderr.seek(0) 24 self.stderr.seek(0)
22 actual = self.stderr.read().split('\n') 25 actual = self.stderr.read().split('\n')
23 actual = [line for line in actual if line] 26 actual = [line for line in actual if line]
24 self.assertEqual(sorted(expected), sorted(actual)) 27 self.assertEqual(sorted(expected), sorted(actual))
25 28
26 def testValidateMSVSSettings_tool_names(self): 29 def testValidateMSVSSettings_tool_names(self):
27 """Tests that only MSVS tool names are allowed.""" 30 """Tests that only MSVS tool names are allowed."""
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 } 1477 }
1475 actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( 1478 actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
1476 msvs_settings, 1479 msvs_settings,
1477 self.stderr) 1480 self.stderr)
1478 self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) 1481 self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
1479 self._ExpectedWarnings([]) 1482 self._ExpectedWarnings([])
1480 1483
1481 1484
1482 if __name__ == '__main__': 1485 if __name__ == '__main__':
1483 unittest.main() 1486 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698