[Zope-Checkins] CVS: ZODB3/zdaemon/tests - testzdoptions.py:1.5
Fred L. Drake, Jr.
fred@zope.com
Mon, 20 Jan 2003 16:40:34 -0500
Update of /cvs-repository/ZODB3/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv4899
Modified Files:
testzdoptions.py
Log Message:
Refactor so the ZEO tests don't pick up things that conflict with the
ZEO-specific option processing.
=== ZODB3/zdaemon/tests/testzdoptions.py 1.4 => 1.5 ===
--- ZODB3/zdaemon/tests/testzdoptions.py:1.4 Mon Jan 20 15:23:21 2003
+++ ZODB3/zdaemon/tests/testzdoptions.py Mon Jan 20 16:40:32 2003
@@ -79,6 +79,22 @@
# Check that we get an error for an unrecognized option
self.check_exit_code(self.OptionsClass(), ["-/"])
+ def check_exit_code(self, options, args):
+ save_sys_stderr = sys.stderr
+ try:
+ sys.stderr = StringIO()
+ try:
+ options.realize(args)
+ except SystemExit, err:
+ self.assertEqual(err.code, 2)
+ else:
+ self.fail("SystemExit expected")
+ finally:
+ sys.stderr = save_sys_stderr
+
+
+class TestBasicFunctionality(TestZDOptions):
+
def test_no_positional_args(self):
# Check that we get an error for positional args when they
# haven't been enabled.
@@ -132,22 +148,9 @@
options.add("setting", None, "a:", handler=int)
self.check_exit_code(options, ["-afoo"])
- def check_exit_code(self, options, args):
- save_sys_stderr = sys.stderr
- try:
- sys.stderr = StringIO()
- try:
- options.realize(args)
- except SystemExit, err:
- self.assertEqual(err.code, 2)
- else:
- self.fail("SystemExit expected")
- finally:
- sys.stderr = save_sys_stderr
-
def test_suite():
suite = unittest.TestSuite()
- for cls in [TestZDOptions]:
+ for cls in [TestBasicFunctionality]:
suite.addTest(unittest.makeSuite(cls))
return suite