Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/224418
Change subject: tests: save a level of indent in test_repos_have_required_jobs
......................................................................
tests: save a level of indent in test_repos_have_required_jobs
Doing an early exit when the condition does not match, saves up a level
of indentation for the rather lenghtycode that follow.
Change-Id: I0048a458c7ff86734f0a58d48f8701a0bbd2b6bc
---
M tests/test_zuul_layout.py
1 file changed, 23 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/config
refs/changes/18/224418/1
diff --git a/tests/test_zuul_layout.py b/tests/test_zuul_layout.py
index ea44948..998e452 100644
--- a/tests/test_zuul_layout.py
+++ b/tests/test_zuul_layout.py
@@ -139,29 +139,32 @@
for pipeline in self.getPipelines():
for regex_compiled, assertions in repos_compiled.items():
for name in self.getPipelineProjectsNames(pipeline.name):
- if regex_compiled.match(name):
- project_def = self.getProjectDef(name)
- requirements = set()
- requirements.add('gate-and-submit')
+ if not regex_compiled.match(name):
+ continue
- if 'check-only' in project_def.keys():
- requirements.add('check-only')
- elif 'check-voter' in project_def.keys():
- # Skins uses a different check pipeline
- requirements.add('check-voter')
- else:
- requirements.add('check')
- requirements.add('test')
+ project_def = self.getProjectDef(name)
- for req_pipeline in requirements:
- # Should be caught by another test:
- self.assertIn(req_pipeline, project_def.keys(),
- 'Project %s lacks %s pipeline' %
- (name, req_pipeline))
- for func in assertions:
- func(name,
- project_def[req_pipeline], req_pipeline)
+ requirements = set()
+ requirements.add('gate-and-submit')
+
+ if 'check-only' in project_def.keys():
+ requirements.add('check-only')
+ elif 'check-voter' in project_def.keys():
+ # Skins uses a different check pipeline
+ requirements.add('check-voter')
+ else:
+ requirements.add('check')
+ requirements.add('test')
+
+ for req_pipeline in requirements:
+ # Should be caught by another test:
+ self.assertIn(req_pipeline, project_def.keys(),
+ 'Project %s lacks %s pipeline' %
+ (name, req_pipeline))
+ for func in assertions:
+ func(name,
+ project_def[req_pipeline], req_pipeline)
return
--
To view, visit https://gerrit.wikimedia.org/r/224418
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0048a458c7ff86734f0a58d48f8701a0bbd2b6bc
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits