[Zodb-checkins] CVS: ZODB3/zdaemon/tests - testzdrun.py:1.3
Fred L. Drake, Jr.
fred@zope.com
Mon, 20 Jan 2003 14:10:06 -0500
Update of /cvs-repository/ZODB3/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv1321
Modified Files:
testzdrun.py
Log Message:
Test for an error when there are positional args and the app hasn't
requested any.
=== ZODB3/zdaemon/tests/testzdrun.py 1.2 => 1.3 ===
--- ZODB3/zdaemon/tests/testzdrun.py:1.2 Mon Jan 20 14:04:27 2003
+++ ZODB3/zdaemon/tests/testzdrun.py Mon Jan 20 14:10:03 2003
@@ -141,11 +141,27 @@
def testOptionsError(self):
# Check that we get an error for an unrecognized option
save_sys_stderr = sys.stderr
+ options = zdoptions.ZDOptions()
try:
sys.stderr = StringIO()
- options = zdoptions.ZDOptions()
try:
options.realize(["-/"])
+ except SystemExit, err:
+ self.assertEqual(err.code, 2)
+ else:
+ self.fail("SystemExit expected")
+ finally:
+ sys.stderr = save_sys_stderr
+
+ def testOptionsNoPositionalArgs(self):
+ # Check that we get an error for positional args when they
+ # haven't been enabled.
+ save_sys_stderr = sys.stderr
+ options = zdoptions.ZDOptions()
+ try:
+ sys.stderr = StringIO()
+ try:
+ options.realize(["A"])
except SystemExit, err:
self.assertEqual(err.code, 2)
else: