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

Side by Side Diff: recipe_modules/platform/test_api.py

Issue 2887543002: [platform] improve testing assertions (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698