changeset 3429:9cdac4c5843e

macro._tests.test_Hits: fixed test by removing cache
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 29 Mar 2008 22:04:44 +0100
parents a53f1e77d372
children c06b749e9c68
files MoinMoin/macro/_tests/test_Hits.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/_tests/test_Hits.py	Sat Mar 29 21:37:53 2008 +0100
+++ b/MoinMoin/macro/_tests/test_Hits.py	Sat Mar 29 22:04:44 2008 +0100
@@ -8,9 +8,10 @@
 """
 import os
 
-from MoinMoin import macro
+from MoinMoin import caching, macro
 from MoinMoin.logfile import eventlog
 from MoinMoin.PageEditor import PageEditor
+from MoinMoin.Page import Page
 
 class TestHits:
     """Hits: testing Hits macro """
@@ -23,6 +24,10 @@
         fpath = self.request.rootpage.getPagePath('event-log', isfile=1)
         if os.path.exists(fpath):
             os.remove(fpath)
+        # hits is based on hitcounts which reads the cache
+        caching.CacheEntry(self.request, 'charts', 'hitcounts', scope='wiki').remove()
+        arena = Page(self.request, self.pagename)
+        caching.CacheEntry(self.request, arena, 'hitcounts', scope='item').remove()
 
     def teardown_class(self):
         if self.shouldDeleteTestPage:
@@ -32,9 +37,13 @@
             fpath = page.getPagePath(use_underlay=0, check_create=0)
             shutil.rmtree(fpath, True)
 
-            fpath = self.request.rootpage.getPagePath('event-log', isfile=1)
-            if os.path.exists(fpath):
-                os.remove(fpath)
+        fpath = self.request.rootpage.getPagePath('event-log', isfile=1)
+        if os.path.exists(fpath):
+            os.remove(fpath)
+        # hits is based on hitcounts which reads the cache
+        caching.CacheEntry(self.request, 'charts', 'hitcounts', scope='wiki').remove()
+        arena = Page(self.request, self.pagename)
+        caching.CacheEntry(self.request, arena, 'hitcounts', scope='item').remove()
 
     def _make_macro(self):
         """Test helper"""