changeset 2454:18c71299e2bb

convert test_wikiutil to py.test
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 21 Jul 2007 21:40:39 +0200
parents adf5ec4874ed
children fe71235f1f7c
files MoinMoin/_tests/test_wikiutil.py
diffstat 1 files changed, 9 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sat Jul 21 21:30:47 2007 +0200
+++ b/MoinMoin/_tests/test_wikiutil.py	Sat Jul 21 21:40:39 2007 +0200
@@ -2,12 +2,13 @@
 """
     MoinMoin - MoinMoin.wikiutil Tests
 
-    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>
+    @copyright: 2003-2004 by Juergen Hermann <jh@web.de>,
+                2007 by MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
 
 import py
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+
 from MoinMoin import wikiutil
 
 
@@ -111,7 +112,7 @@
     def testSystemPagesGroupNotEmpty(self):
         assert self.request.dicts.members('SystemPagesGroup')
 
-class TestSystemPage(unittest.TestCase):
+class TestSystemPage:
     systemPages = (
         # First level, on SystemPagesGroup
         'SystemPagesInEnglishGroup',
@@ -126,14 +127,12 @@
     def testSystemPage(self):
         """wikiutil: good system page names accepted, bad rejected"""
         for name in self.systemPages:
-            self.assert_(wikiutil.isSystemPage(self.request, name),
-                '"%(name)s" is a system page' % locals())
+            assert wikiutil.isSystemPage(self.request, name)
         for name in self.notSystemPages:
-            self.failIf(wikiutil.isSystemPage(self.request, name),
-                '"%(name)s" is NOT a system page' % locals())
+            assert not  wikiutil.isSystemPage(self.request, name)
 
 
-class TestTemplatePage(unittest.TestCase):
+class TestTemplatePage:
     good = (
         'aTemplate',
         'MyTemplate',
@@ -146,20 +145,12 @@
         'XTemplateInFront',
     )
 
-    # require default page_template_regex config
-    def setUp(self):
-        self.config = self.TestConfig(defaults=['page_template_regex'])
-    def tearDown(self):
-        self.config.restore()
-
     def testTemplatePage(self):
         """wikiutil: good template names accepted, bad rejected"""
         for name in self.good:
-            self.assert_(wikiutil.isTemplatePage(self.request, name),
-                '"%(name)s" is a valid template name' % locals())
+            assert  wikiutil.isTemplatePage(self.request, name)
         for name in self.bad:
-            self.failIf(wikiutil.isTemplatePage(self.request, name),
-                '"%(name)s" is NOT a valid template name' % locals())
+            assert not wikiutil.isTemplatePage(self.request, name)
 
 
 class TestParmeterParser: