| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import shutil | 7 import shutil |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 import unittest | 10 import unittest |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 self.patch = mock.patch.dict('os.environ', | 110 self.patch = mock.patch.dict('os.environ', |
| 111 {'NACL_SDK_ROOT': self.tempdir}) | 111 {'NACL_SDK_ROOT': self.tempdir}) |
| 112 self.patch.start() | 112 self.patch.start() |
| 113 | 113 |
| 114 def tearDown(self): | 114 def tearDown(self): |
| 115 shutil.rmtree(self.tempdir) | 115 shutil.rmtree(self.tempdir) |
| 116 self.patch.stop() | 116 self.patch.stop() |
| 117 | 117 |
| 118 def testGetSDKVersion(self): | 118 def testGetSDKVersion(self): |
| 119 """correctly parses README to find SDK version.""" | 119 """correctly parses README to find SDK version.""" |
| 120 expected_version = (16, 196) | 120 expected_version = (16, '196') |
| 121 with open(os.path.join(self.tempdir, 'README'), 'w') as out: | 121 with open(os.path.join(self.tempdir, 'README'), 'w') as out: |
| 122 out.write('Version: %s\n' % expected_version[0]) | 122 out.write('Version: %s\n' % expected_version[0]) |
| 123 out.write('Chrome Revision: %s\n' % expected_version[1]) | 123 out.write('Chrome Revision: %s\n' % expected_version[1]) |
| 124 | 124 |
| 125 version = getos.GetSDKVersion() | 125 version = getos.GetSDKVersion() |
| 126 self.assertEqual(version, expected_version) | 126 self.assertEqual(version, expected_version) |
| 127 | 127 |
| 128 | 128 |
| 129 if __name__ == '__main__': | 129 if __name__ == '__main__': |
| 130 unittest.main() | 130 unittest.main() |
| OLD | NEW |