Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/224417
Change subject: tests: precompile some regex
......................................................................
tests: precompile some regex
Avoid recompiling over and over the same regex by pre compiling them
before the loop in TestZuulLayout.test_repos_have_required_jobs()
Change-Id: If099761cec93f7dd4b7b88e724c144be04984269
---
M tests/test_zuul_layout.py
1 file changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/config
refs/changes/17/224417/1
diff --git a/tests/test_zuul_layout.py b/tests/test_zuul_layout.py
index 804cd2b..ea44948 100644
--- a/tests/test_zuul_layout.py
+++ b/tests/test_zuul_layout.py
@@ -130,11 +130,16 @@
],
}
+ # Pre compile above regular expressions
+ repos_compiled = {}
+ for (regex, assertions) in repos.iteritems():
+ repos_compiled[re.compile(regex)] = assertions
+ del repos
+
for pipeline in self.getPipelines():
- for regex, assertions in repos.items():
- regex_comp = re.compile(regex)
+ for regex_compiled, assertions in repos_compiled.items():
for name in self.getPipelineProjectsNames(pipeline.name):
- if regex_comp.match(name):
+ if regex_compiled.match(name):
project_def = self.getProjectDef(name)
requirements = set()
--
To view, visit https://gerrit.wikimedia.org/r/224417
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If099761cec93f7dd4b7b88e724c144be04984269
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