[Zope-Checkins] CVS: Zope/lib/python/OFS/tests - testRanges.py:1.5 framework.py:NONE
Tres Seaver
tseaver@zope.com
Wed, 17 Oct 2001 16:01:03 -0400
Update of /cvs-repository/Zope/lib/python/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv30119/lib/python/OFS/tests
Modified Files:
testRanges.py
Removed Files:
framework.py
Log Message:
o Land unit test cleanup from branch.
o Known breakage as of 2001/10/17:
- TAL test suite is very broken (TAL is currently suppressed in
lib/python/.testinfo).
- AccessControl tests don't run if run first; lib/python/.testinfo
pushes them to the end of the queue, at which point they *do* run.
Global side effects suck!
- lib/python/BTrees/testBTreesUnicode.py: weird flakiness around
comparison of ASCII and Unicode strings; breaks in different
ways under Python 2.1 and 2.2.
- lib/python/Products/PageTemplates/tests: three tests break due
to security asserctions.
=== Zope/lib/python/OFS/tests/testRanges.py 1.4 => 1.5 ===
#
##############################################################################
-
-import os, sys
-execfile(os.path.join(sys.path[0], 'framework.py'))
+import os, sys, unittest
import string, whrandom, cStringIO, time, re
import Zope
@@ -114,28 +112,34 @@
# Test case setup and teardown
def setUp(self):
self.responseOut = cStringIO.StringIO()
- self.app = makerequest(Zope.app(), stdout=self.responseOut)
- try: self.app._delObject(TESTFOLDER_NAME)
- except AttributeError: pass
- self.app.manage_addFolder(TESTFOLDER_NAME)
-
- data = string.letters
- self.app[TESTFOLDER_NAME].manage_addFile('file', file=data,
- content_type='text/plain')
-
- self.file = self.app[TESTFOLDER_NAME].file
- self.data = data
-
- # Hack, we need a _p_mtime for the file, so we make sure that it has
- # one. We use a subtransaction, which means we can rollback later and
- # pretend we didn't touch the ZODB.
- get_transaction().commit()
+ self.connection = Zope.DB.open()
+ try:
+ self.root = self.connection.root()[ 'Application' ]
+ self.app = makerequest(self.root, stdout=self.responseOut)
+ try: self.app._delObject(TESTFOLDER_NAME)
+ except AttributeError: pass
+ self.app.manage_addFolder(TESTFOLDER_NAME)
+
+ data = string.letters
+ self.app[TESTFOLDER_NAME].manage_addFile('file', file=data,
+ content_type='text/plain')
+
+ self.file = self.app[TESTFOLDER_NAME].file
+ self.data = data
+
+ # Hack, we need a _p_mtime for the file, so we make sure that it
+ # has one. We use a subtransaction, which means we can rollback
+ # later and pretend we didn't touch the ZODB.
+ get_transaction().commit()
+ except:
+ self.connection.close()
+ raise
def tearDown(self):
try: self.app._delObject(TESTFOLDER_NAME)
except AttributeError: pass
get_transaction().commit()
- self.app._p_jar.close()
+ self.connection.close()
self.app = None
del self.app
@@ -395,4 +399,14 @@
self.expectOK('21-25,10-20',
if_range=self.file.http__etag() + 'bar')
-framework()
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite( TestRequestRange ) )
+ return suite
+
+def main():
+ unittest.TextTestRunner().run(test_suite())
+
+if __name__ == '__main__':
+ main()
=== Removed File Zope/lib/python/OFS/tests/framework.py ===