Windows Test Failures and XMLExportImport
The BuildBot (http://buildbot.zope.org) is getting these test failures for the trunk on Windows:
Error in test test_OFS_ObjectManager__importObjectFromFile_xml (OFS.tests.test_XMLExportImport.XMLExportImportTests) Traceback (most recent call last): File "c:\python24\lib\unittest.py", line 260, in run testMethod() File "C:\buildbot\bbwin2\zc-bbwin2--Windows 2000--Zope---branches---2.9--2.4\build\lib\python\OFS\tests\test_XMLExportImport.py", line 102, in test_OFS_ObjectManager__importObjectFromFile_xml sub._importObjectFromFile(ostream.name, 0, 0) File "C:\buildbot\bbwin2\zc-bbwin2--Windows 2000--Zope---branches---2.9--2.4\build\lib\python\OFS\ObjectManager.py", line 602, in _importObjectFromFile ob=connection.importFile( File "C:\buildbot\bbwin2\zc-bbwin2--Windows 2000--Zope---branches---2.9--2.4\build\lib\python\ZODB\ExportImport.py", line 59, in importFile f = open(f, 'rb') IOError: [Errno 13] Permission denied: 'c:\\docume~1\\buildbot\\locals~1\\temp\\tmpftc3py.xml'
test_export_import_as_file_idempotent (OFS.tests.test_XMLExportImport.XMLExportImportTests)
Error in test test_export_import_as_file_idempotent (OFS.tests.test_XMLExportImport.XMLExportImportTests) Traceback (most recent call last): File "c:\python24\lib\unittest.py", line 260, in run testMethod() File "C:\buildbot\bbwin2\zc-bbwin2--Windows 2000--Zope---branches---2.9--2.4\build\lib\python\OFS\tests\test_XMLExportImport.py", line 75, in test_export_import_as_file_idempotent newobj = importXML(connection, ostream.name) File "C:\buildbot\bbwin2\zc-bbwin2--Windows 2000--Zope---branches---2.9--2.4\build\lib\python\OFS\XMLExportImport.py", line 101, in importXML file=open(file, 'rb') IOError: [Errno 13] Permission denied: 'c:\\docume~1\\buildbot\\locals~1\\temp\\tmpizfhqn.xml' -- Benji York Senior Software Engineer Zope Corporation
Benji York wrote:
2000--Zope---branches---2.9--2.4\build\lib\python\OFS\tests\test_XMLExportImport.py",
I suspect the following pattern needs to be changed: ostream = tempfile.NamedTemporaryFile(suffix='.xml') try: data = exportXML(connection, oid, ostream) ostream.flush() sub._importObjectFromFile(ostream.name, 0, 0) finally: ostream.close() ..since I bet the file created will be locked, and when the read line after the flush tries to read, it's told it can't... gotta love windows file semantics :-( Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote:
I suspect the following pattern needs to be changed:
ostream = tempfile.NamedTemporaryFile(suffix='.xml') try: data = exportXML(connection, oid, ostream) ostream.flush() sub._importObjectFromFile(ostream.name, 0, 0) finally: ostream.close()
Yep, that looks like it. Either I'll make my first commit to Zope 2 ever :) or if you want to, you can change it to something like this: import tempfile import os fname = 'import_export.xml' tempdir = tempfile.mkdtemp() try: ostream = open(fname, 'wb') try: data = exportXML(connection, oid, ostream) finally: ostream.close() sub._importObjectFromFile(fname, 0, 0) finally: os.rmdir(tempdir) Thanks for looking into this. -- Benji York Senior Software Engineer Zope Corporation
Benji York wrote:
Yep, that looks like it. Either I'll make my first commit to Zope 2 ever :) or if you want to, you can change it to something like this:
import tempfile import os
fname = 'import_export.xml' tempdir = tempfile.mkdtemp() try: ostream = open(fname, 'wb') try: data = exportXML(connection, oid, ostream) finally: ostream.close()
sub._importObjectFromFile(fname, 0, 0) finally: os.rmdir(tempdir)
Thanks for looking into this.
I'm actually trying to write some tests for historyCopy, so I'm seeing these failrues when I run the OFS tests, so I'll fix 'em... However, if you can point me in the direction of any tests that use a scratch ZODB to test ZODB-stuff (ie: historyCopy in my case...) I'd be very greatful if you could point me at them. Also, if I do a writeable checkout of Zope 2 trunk or Zope 2.9 branch, any ideas how I then compile things suchthat I can run the tests, and how do I run the tests once I've successfully compiled everything? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Benji York -
Chris Withers