From ffb48e1aaf7f21ad5cc6ee05f5c3ff971a3a967b Mon Sep 17 00:00:00 2001 From: Eric Boren Date: Wed, 19 Apr 2017 14:39:21 -0400 Subject: Recipes: remove some pragma: no cover These are the remaining instances, and they're harder to deal with: $ git grep pragma recipe_modules/swarming/api.py: except self.m.step.StepFailure as e: # pragma: no cover recipe_modules/swarming/api.py: if len(ids) > 1: # pragma: nocover recipes/ct_skps.py: if api.path.exists(version_file): # pragma: nocover recipes/ct_skps.py: if api.path.exists(blacklist_file): # pragma: nocover recipes/upload_nano_results.py: if len(results) != 1: # pragma: nocover Bug: skia:6473 Change-Id: If75e2ffcf39a944b513b9005bbc4bd9c4fb031f6 Reviewed-on: https://skia-review.googlesource.com/13867 Reviewed-by: Ravi Mistry Commit-Queue: Eric Boren --- .../builder_name_schema/builder_name_schema.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'infra/bots/recipe_modules/builder_name_schema/builder_name_schema.py') diff --git a/infra/bots/recipe_modules/builder_name_schema/builder_name_schema.py b/infra/bots/recipe_modules/builder_name_schema/builder_name_schema.py index b004ead532..2c875bacca 100644 --- a/infra/bots/recipe_modules/builder_name_schema/builder_name_schema.py +++ b/infra/bots/recipe_modules/builder_name_schema/builder_name_schema.py @@ -47,8 +47,6 @@ def _LoadSchema(): return list(map(_UnicodeToStr, obj)) elif isinstance(obj, tuple): return tuple(map(_UnicodeToStr, obj)) - else: - return obj # pragma: no cover builder_name_json_filename = os.path.join( os.path.dirname(__file__), 'builder_name_schema.json') @@ -72,16 +70,16 @@ def _LoadSchema(): _LoadSchema() -def MakeBuilderName(role, extra_config=None, **kwargs): # pragma: no cover +def MakeBuilderName(role, extra_config=None, **kwargs): schema = BUILDER_NAME_SCHEMA.get(role) - if not schema: # pragma: no cover + if not schema: raise ValueError('%s is not a recognized role.' % role) for k, v in kwargs.iteritems(): - if BUILDER_NAME_SEP in v: # pragma: no cover + if BUILDER_NAME_SEP in v: raise ValueError('%s not allowed in %s.' % (BUILDER_NAME_SEP, v)) - if not k in schema: # pragma: no cover + if not k in schema: raise ValueError('Schema does not contain "%s": %s' %(k, schema)) - if extra_config and BUILDER_NAME_SEP in extra_config: # pragma: no cover + if extra_config and BUILDER_NAME_SEP in extra_config: raise ValueError('%s not allowed in %s.' % (BUILDER_NAME_SEP, extra_config)) name_parts = [role] @@ -98,7 +96,7 @@ def DictForBuilderName(builder_name): def pop_front(): try: return split_name.pop(0) - except: # pragma: no cover + except: raise ValueError('Invalid builder name: %s' % builder_name) result = {} @@ -109,9 +107,9 @@ def DictForBuilderName(builder_name): result[key] = pop_front() if split_name: result['extra_config'] = pop_front() - if split_name: # pragma: no cover + if split_name: raise ValueError('Invalid builder name: %s' % builder_name) - else: # pragma: no cover + else: raise ValueError('Invalid builder name: %s' % builder_name) return result -- cgit v1.2.3