[Zope3-checkins] CVS: Zope3/src/zope/app/applicationcontrol/tests - test_zodbcontrol.py:1.1 zodb.fs:1.1 test_applicationcontrol.py:1.4 test_iservercontrol.py:1.4 test_runtimeinfo.py:1.5 test_zopeversion.py:1.4
Stephan Richter
srichter@cosmos.phy.tufts.edu
Thu, 31 Jul 2003 17:38:00 -0400
Update of /cvs-repository/Zope3/src/zope/app/applicationcontrol/tests
In directory cvs.zope.org:/tmp/cvs-serv12920/applicationcontrol/tests
Modified Files:
test_applicationcontrol.py test_iservercontrol.py
test_runtimeinfo.py test_zopeversion.py
Added Files:
test_zodbcontrol.py zodb.fs
Log Message:
- Added ZODB Control. You can now see the size of the ZODB and pack it the
usual way, specifying the number of days that should be preserved.
- Cleaned up the crufty ApplicationControl code a bit to the latest
practices and cleaned up whitespace stuff.
=== Added File Zope3/src/zope/app/applicationcontrol/tests/test_zodbcontrol.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
##############################################################################
"""Runtime Info Tests
$Id: test_zodbcontrol.py,v 1.1 2003/07/31 21:37:23 srichter Exp $
"""
import unittest
import os
from zodb.storage.file import FileStorage
from zodb.db import DB
from zope.app.applicationcontrol import tests
from zope.app.applicationcontrol.zodbcontrol import ZODBControl
from zope.app.applicationcontrol.applicationcontrol import applicationController
class Test(unittest.TestCase):
def setUp(self):
db_file = os.path.join(os.path.dirname(tests.__file__), 'zodb.fs')
self.db = DB(FileStorage(db_file), '')
self.control = ZODBControl(applicationController)
def test_getDatabaseSize(self):
self.assertEqual(self.control.getDatabaseSize(self.db), 1183)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(Test),
))
if __name__ == '__main__':
unittest.main()
=== Added File Zope3/src/zope/app/applicationcontrol/tests/zodb.fs ===
<Binary-ish file>
=== Zope3/src/zope/app/applicationcontrol/tests/test_applicationcontrol.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/applicationcontrol/tests/test_applicationcontrol.py:1.3 Wed Apr 30 19:37:48 2003
+++ Zope3/src/zope/app/applicationcontrol/tests/test_applicationcontrol.py Thu Jul 31 17:37:23 2003
@@ -10,42 +10,25 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
##############################################################################
-"""
+"""Application Control Tests
$Id$
"""
-
-from unittest import TestCase, main, makeSuite
+import unittest
from zope.interface.verify import verifyObject
import time
-from zope.app.applicationcontrol.applicationcontrol import \
- ApplicationControl
-from zope.app.interfaces.applicationcontrol.applicationcontrol import \
- IApplicationControl
+from zope.app.applicationcontrol.applicationcontrol import ApplicationControl
+from zope.app.interfaces.applicationcontrol import IApplicationControl
# seconds, time values may differ in order to be assumed equal
time_tolerance = 2
-#############################################################################
-# If your tests change any global registries, then uncomment the
-# following import and include CleanUp as a base class of your
-# test. It provides a setUp and tearDown that clear global data that
-# has registered with the test cleanup framework. Don't use this
-# tests outside the Zope package.
-
-# from zope.testing.cleanup import CleanUp # Base class w registry cleanup
-
-#############################################################################
-
-class Test(TestCase):
+class Test(unittest.TestCase):
def _Test__new(self):
return ApplicationControl()
- ############################################################
- # Interface-driven tests:
-
def test_IVerify(self):
verifyObject(IApplicationControl, self._Test__new())
@@ -57,7 +40,9 @@
def test_suite():
- return makeSuite(Test)
+ return unittest.TestSuite((
+ unittest.makeSuite(Test),
+ ))
-if __name__=='__main__':
- main(defaultTest='test_suite')
+if __name__ == '__main__':
+ unittest.main()
=== Zope3/src/zope/app/applicationcontrol/tests/test_iservercontrol.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/applicationcontrol/tests/test_iservercontrol.py:1.3 Wed Apr 30 19:37:48 2003
+++ Zope3/src/zope/app/applicationcontrol/tests/test_iservercontrol.py Thu Jul 31 17:37:23 2003
@@ -10,29 +10,16 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
##############################################################################
-"""
+"""IServerControl tests
$Id$
"""
-
-from unittest import TestCase, main, makeSuite
+import unittest
from zope.interface.verify import verifyObject
-from zope.app.interfaces.applicationcontrol.servercontrol import \
+from zope.app.interfaces.applicationcontrol import \
IServerControl, DoublePriorityError, NotCallableError
-
-#############################################################################
-# If your tests change any global registries, then uncomment the
-# following import and include CleanUp as a base class of your
-# test. It provides a setUp and tearDown that clear global data that
-# has registered with the test cleanup framework. Don't use this
-# tests outside the Zope package.
-
-# from zope.testing.cleanup import CleanUp # Base class w registry cleanup
-
-#############################################################################
-
def stub_callback():
"""stupid callable object"""
pass
@@ -62,14 +49,16 @@
self.assertRaises(DoublePriorityError,
server_control.registerShutdownHook, stub_callback, 10, "test2")
-class Test(BaseTestIServerControl, TestCase):
+class Test(BaseTestIServerControl, unittest.TestCase):
def _Test__new(self):
- from zope.app.applicationcontrol.servercontrol \
- import ServerControl
+ from zope.app.applicationcontrol.servercontrol import ServerControl
return ServerControl()
+
def test_suite():
- return makeSuite(Test)
+ return unittest.TestSuite((
+ unittest.makeSuite(Test),
+ ))
-if __name__=='__main__':
- main(defaultTest='test_suite')
+if __name__ == '__main__':
+ unittest.main()
=== Zope3/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py:1.4 Sat Jun 7 02:37:19 2003
+++ Zope3/src/zope/app/applicationcontrol/tests/test_runtimeinfo.py Thu Jul 31 17:37:23 2003
@@ -10,22 +10,19 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
##############################################################################
-"""
+"""Runtime Info Tests
-Revision information:
$Id$
"""
-
-from unittest import TestCase, main, makeSuite
-from zope.interface.verify import verifyObject
-
+import unittest
import os, sys, time
+
from zope.component import getService
-from zope.app.interfaces.applicationcontrol.runtimeinfo import IRuntimeInfo
-from zope.app.applicationcontrol.applicationcontrol import \
- applicationController
-from zope.app.interfaces.applicationcontrol.zopeversion import IZopeVersion
from zope.interface import implements
+from zope.interface.verify import verifyObject
+from zope.app.applicationcontrol.applicationcontrol import applicationController
+from zope.app.interfaces.applicationcontrol import IRuntimeInfo, IZopeVersion
+from zope.app.services.tests.placefulsetup import PlacefulSetup
# seconds, time values may differ in order to be assumed equal
time_tolerance = 2
@@ -39,18 +36,12 @@
def getZopeVersion(self):
return stupid_version_string
-from zope.app.services.tests.placefulsetup\
- import PlacefulSetup
-
-class Test(PlacefulSetup, TestCase):
+class Test(PlacefulSetup, unittest.TestCase):
def _Test__new(self):
from zope.app.applicationcontrol.runtimeinfo import RuntimeInfo
return RuntimeInfo(applicationController)
- ############################################################
- # Interface-driven tests:
-
def testIRuntimeInfoVerify(self):
verifyObject(IRuntimeInfo, self._Test__new())
@@ -95,8 +86,11 @@
self.failUnless(abs(asserted_uptime - test_uptime) < time_tolerance)
+
def test_suite():
- return makeSuite(Test)
+ return unittest.TestSuite((
+ unittest.makeSuite(Test),
+ ))
-if __name__=='__main__':
- main(defaultTest='test_suite')
+if __name__ == '__main__':
+ unittest.main()
=== Zope3/src/zope/app/applicationcontrol/tests/test_zopeversion.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/applicationcontrol/tests/test_zopeversion.py:1.3 Wed Apr 30 19:37:48 2003
+++ Zope3/src/zope/app/applicationcontrol/tests/test_zopeversion.py Thu Jul 31 17:37:23 2003
@@ -11,39 +11,23 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Zope Version Tests
-Revision information:
$Id$
"""
-
-from unittest import TestCase, main, makeSuite
+import unittest
from zope.interface.verify import verifyObject
-
-from zope.app.interfaces.applicationcontrol.zopeversion import IZopeVersion
+from zope.app.interfaces.applicationcontrol import IZopeVersion
from zope.app.applicationcontrol.zopeversion import ZopeVersion
import os
-
-#############################################################################
-# If your tests change any global registries, then uncomment the
-# following import and include CleanUp as a base class of your
-# test. It provides a setUp and tearDown that clear global data that
-# has registered with the test cleanup framework. Don't use this
-# tests outside the Zope package.
-
-# from zope.testing.cleanup import CleanUp # Base class w registry cleanup
-
-#############################################################################
-
-class Test(TestCase):
+class Test(unittest.TestCase):
def _Test__new(self):
return ZopeVersion()
def _getZopeVersion(self):
- """example zope version implementation
- """
+ """example zope version implementation"""
version_id = "Development/Unknown"
version_tag = ""
is_cvs = 0
@@ -81,9 +65,10 @@
self.assertEqual(zope_version.getZopeVersion(), self._getZopeVersion())
-
def test_suite():
- return makeSuite(Test)
+ return unittest.TestSuite((
+ unittest.makeSuite(Test),
+ ))
-if __name__=='__main__':
- main(defaultTest='test_suite')
+if __name__ == '__main__':
+ unittest.main()