[Zope3-dev] Newish Windows test failures

Marius Gedminas mgedmin at b4net.lt
Wed Jun 30 15:03:32 EDT 2004


On Thu, Jun 24, 2004 at 06:01:11PM -0400, Tim Peters wrote:
> I'm seeing 7 similar test failures on current Zope3 trunk.  The first is
> typical:
> 
> runTest (zope.tal.tests.test_files.FileTestCase) ...
> 3r3
> < tests/input/test_sa1.xml
> ---
> > tests\input\test_sa1.xml

My fault.

> That is, looks like these tests expect forward slashes as path separators,
> but are actually getting backslashes on Windows.  If someone knows how these
> tests work, I'd be happy to help repair them.

test_sa*.xml files are processed with sourceAnnotations enabled in the
TAL interpreter.  Enabling sourceAnnotations cause the interpreter to
sprinkle the output with HTML/XML comments with the file name and line
number.  The file name is passed as an argument to TALGenerator.  In
this specific case it happens in src/zope/tal/driver.py and we can pass
whatever file name we fancy.

Please try the following patch:

Index: src/zope/tal/driver.py
===================================================================
--- src/zope/tal/driver.py      (revision 26005)
+++ src/zope/tal/driver.py      (working copy)
@@ -190,6 +190,7 @@
     prefix = os.path.dirname(os.path.abspath(__file__)) + os.path.sep
     if filename.startswith(prefix):
         filename = filename[len(prefix):]
+    filename = filename.replace(os.sep, '/') # test files expect slashes
     if mode == "html":
         from zope.tal.htmltalparser import HTMLTALParser
         p = HTMLTALParser(gen=TALGenerator(source_file=filename, xml=0))


An alternative solution is to change the filename computation (half of which
is visible in the diff above) to a simple

  filename = os.path.basename(file)

then remove subdirs from test_sa*.xml files in src/zope/tal/output and forget
about slashes at all.

HTH,
Marius Gedminas
-- 
Never trust an operating system you don't have sources for.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20040630/5fb8cbaa/attachment.bin


More information about the Zope3-dev mailing list