You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/02/24 12:48:24 UTC
[30/50] [abbrv] allura git commit: [#4542] Mock repo init to avoid
failures when run in parallel
[#4542] Mock repo init to avoid failures when run in parallel
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/7a584f93
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/7a584f93
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/7a584f93
Branch: refs/heads/ib/7827
Commit: 7a584f93720bbca1c71f85073349e510e3e431f5
Parents: b967bc5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Feb 18 17:37:39 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Feb 18 17:37:39 2015 +0000
----------------------------------------------------------------------
Allura/allura/tests/test_webhooks.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/7a584f93/Allura/allura/tests/test_webhooks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_webhooks.py b/Allura/allura/tests/test_webhooks.py
index c0f9140..fee1556 100644
--- a/Allura/allura/tests/test_webhooks.py
+++ b/Allura/allura/tests/test_webhooks.py
@@ -40,6 +40,9 @@ class TestWebhookBase(object):
def setUp(self):
setup_basic_test()
+ self.patches = self.monkey_patch()
+ for p in self.patches:
+ p.start()
self.setup_with_tools()
self.project = M.Project.query.get(shortname=test_project_with_repo)
self.git = self.project.app_instance('src')
@@ -50,10 +53,20 @@ class TestWebhookBase(object):
secret='secret')
session(self.wh).flush(self.wh)
+ def tearDown(self):
+ for p in self.patches:
+ p.stop()
+
@with_git
def setup_with_tools(self):
pass
+ def monkey_patch(self):
+ # we don't need actual repo here, and this avoids test conflicts when
+ # running in parallel
+ repo_init = patch.object(M.Repository, 'init', autospec=True)
+ return [repo_init]
+
class TestValidators(TestWebhookBase):
@@ -97,10 +110,10 @@ class TestWebhookController(TestController):
def setUp(self):
super(TestWebhookController, self).setUp()
- self.setup_with_tools()
self.patches = self.monkey_patch()
for p in self.patches:
p.start()
+ self.setup_with_tools()
self.project = M.Project.query.get(shortname=test_project_with_repo)
self.git = self.project.app_instance('src')
self.url = str(self.git.admin_url + 'webhooks')
@@ -120,7 +133,10 @@ class TestWebhookController(TestController):
'gen_secret',
return_value='super-secret',
autospec=True)
- return [gen_secret]
+ # we don't need actual repo here, and this avoids test conflicts when
+ # running in parallel
+ repo_init = patch.object(M.Repository, 'init', autospec=True)
+ return [gen_secret, repo_init]
def create_webhook(self, data, url=None):
url = url or self.url