You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/02/06 16:42:52 UTC
[39/50] git commit: [#4691] Fixed tests failing due to mocked or
improperly persisted ModelCache
[#4691] Fixed tests failing due to mocked or improperly persisted ModelCache
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/69f5fcf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/69f5fcf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/69f5fcf2
Branch: refs/heads/cj/4691
Commit: 69f5fcf2d7eece89bba539acd6c64970ed06af9c
Parents: be38780
Author: Cory Johns <jo...@geek.net>
Authored: Wed Jan 23 16:28:48 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 5 20:22:52 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo_refresh.py | 8 ++++----
Allura/allura/tests/model/test_repo.py | 1 -
AlluraTesting/alluratest/controller.py | 1 +
ForgeGit/forgegit/tests/model/test_repository.py | 4 ----
4 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/69f5fcf2/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 48a64e7..4bbd6e1 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -493,10 +493,10 @@ def compute_lcds(commit, cache):
if not trees:
log.error('Missing TreesDoc for %s; skipping compute_lcd' % commit)
return
- c.model_cache = cache
- _update_tree_cache(trees.tree_ids, cache)
- tree = _pull_tree(cache, commit.tree_id, commit)
- _compute_lcds(tree, cache)
+ with h.push_config(c, model_cache=cache):
+ _update_tree_cache(trees.tree_ids, cache)
+ tree = _pull_tree(cache, commit.tree_id, commit)
+ _compute_lcds(tree, cache)
def _compute_lcds(tree, cache):
cache._processed_trees += 1
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/69f5fcf2/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index 5100ea1..9745441 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -79,7 +79,6 @@ class TestLastCommit(unittest.TestCase):
def setUp(self):
setup_basic_test()
setup_global_objects()
- c.model_cache = M.repo.ModelCache()
self.repo = mock.Mock('repo', _commits=OrderedDict(), _last_commit=None)
self.repo.shorthand_for_commit = lambda _id: _id[:6]
self.repo.commits = self._commits
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/69f5fcf2/AlluraTesting/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTesting/alluratest/controller.py b/AlluraTesting/alluratest/controller.py
index 71e5f85..bb91acd 100644
--- a/AlluraTesting/alluratest/controller.py
+++ b/AlluraTesting/alluratest/controller.py
@@ -80,6 +80,7 @@ def setup_unit_test():
REGISTRY.register(allura.credentials, allura.lib.security.Credentials())
c.memoize_cache = {}
c.queued_messages = None
+ c.model_cache = None
ThreadLocalORMSession.close_all()
def setup_global_objects():
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/69f5fcf2/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 1c5045b..d18b017 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -44,8 +44,6 @@ class TestNewGit(unittest.TestCase):
# tool = 'git',
# status = 'creating')
self.repo.refresh()
- # refresh sets c.model_cache, which can cause persistence between tests
- c.model_cache = None
self.rev = M.repo.Commit.query.get(_id=self.repo.heads[0]['object_id'])
self.rev.repo = self.repo
ThreadLocalORMSession.flush_all()
@@ -115,8 +113,6 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
tool = 'git',
status = 'creating')
self.repo.refresh()
- # refresh sets c.model_cache, which can cause persistence between tests
- c.model_cache = None
ThreadLocalORMSession.flush_all()
ThreadLocalORMSession.close_all()