| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine import recipe_test_api | 5 from recipe_engine import recipe_test_api |
| 6 | 6 |
| 7 class PlatformTestApi(recipe_test_api.RecipeTestApi): | 7 class PlatformTestApi(recipe_test_api.RecipeTestApi): |
| 8 @recipe_test_api.mod_test_data | 8 @recipe_test_api.mod_test_data |
| 9 @staticmethod | 9 @staticmethod |
| 10 def name(name): | 10 def name(name): |
| 11 assert name in ('win', 'linux', 'mac') | 11 assert name in ('win', 'linux', 'mac'), 'unknown platform %r' % (name,) |
| 12 return name | 12 return name |
| 13 | 13 |
| 14 @recipe_test_api.mod_test_data | 14 @recipe_test_api.mod_test_data |
| 15 @staticmethod | 15 @staticmethod |
| 16 def bits(bits): | 16 def bits(bits): |
| 17 assert bits in (32, 64) | 17 assert bits in (32, 64), 'unknown bitness %r' % (bits,) |
| 18 return bits | 18 return bits |
| 19 | 19 |
| 20 @recipe_test_api.mod_test_data | 20 @recipe_test_api.mod_test_data |
| 21 @staticmethod | 21 @staticmethod |
| 22 def cpu_count(cpu_count): | 22 def cpu_count(cpu_count): |
| 23 assert isinstance(cpu_count, int) | 23 assert isinstance(cpu_count, int), 'bad type %r' % (type(cpu_count),) |
| 24 assert cpu_count > 0 | 24 assert cpu_count > 0, 'bad cpu_count %r' % (cpu_count,) |
| 25 return cpu_count | 25 return cpu_count |
| 26 | 26 |
| 27 def __call__(self, name, bits): | 27 def __call__(self, name, bits): |
| 28 return self.name(name) + self.bits(bits) | 28 return self.name(name) + self.bits(bits) |
| 29 | 29 |
| OLD | NEW |