r138 - branches/rewrite/tests/Config

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Sat, 03 Jul 2004 14:20:26 -0600


Author: otavio
Date: Sat Jul  3 14:20:26 2004
New Revision: 138

Modified:
   branches/rewrite/tests/Config/test.py
Log:
Change it to function structure.

Modified: branches/rewrite/tests/Config/test.py
==============================================================================
--- branches/rewrite/tests/Config/test.py	(original)
+++ branches/rewrite/tests/Config/test.py	Sat Jul  3 14:20:26 2004
@@ -25,15 +25,18 @@
 ## Set the debuggin level
 #getLogger().setLevel(DEBUG)
 
-stdout.write("Testing a good configuration file... ")
-try:
-    Config('good.conf')
-    print "Works."
-except InvalidOption, msg:
-    print("Failed to identify the [%s] option on [%s] section."
-          % (msg.option, msg.section))
-except InvalidSection, msg:
-    print("Failed to identify the [%s] section." % msg.section)
-except Exception, msg:
-    print "Failed. Returned", msg
+def test(msg, conf):
+    stdout.write(msg + "... ")
+    try:
+        Config(conf)
+        print "Works."
+    except InvalidOption, msg:
+        print("Failed to identify the [%s] option on [%s] section."
+              % (msg.option, msg.section))
+    except InvalidSection, msg:
+        print("Failed to identify the [%s] section." % msg.section)
+    except Exception, msg:
+        print "Failed. Returned", msg
 
+
+test('Good configuration file', 'good.conf')