[Zope3-dev] Failure to load functional test - test_datetimewidget.py
Dave Harris
dpharris76 at msn.com
Sun Jan 18 10:18:47 EST 2004
I finally got through the unit tests (8 failures, 2 errors) under Windows
XP/mingw32 (effusive thanks to Tim Peters for the recent changes to
wrapper.c - worked great!).
I decided to try the functional tests (for the first time) and directly
encountered a problem. While unittest is assembling the test suite, it
coughs up a syntax error in
src/zope/app/browser/form/ftests/test_datetimewidget.py:
Traceback (most recent call last):
File "test.py", line 937, in ?
process_args()
File "test.py", line 927, in process_args
bad = main(module_filter, test_filter, libdir)
File "test.py", line 698, in main
runner(files, test_filter, debug)
File "test.py", line 616, in runner
s = get_suite(file)
File "test.py", line 521, in get_suite
mod = package_import(modname)
File "test.py", line 513, in package_import
mod = __import__(modname)
File
"D:\sf\Zope3\src\zope\app\browser\form\ftests\test_datetimewidget.py", line
163
'<option value="(.*)" selected>*.</select>' % field
^
SyntaxError: invalid syntax
As I reviewed the source file with 'vim', I saw MSDOS line endings - that
is, ^M at the end of each line. And the line identified in the traceback is
actually line 82 in the source file.
pattern = '<select .* name="field.%s".*>.*' \^M
'<option value="(.*)" selected>*.</select>' % field^M
The source of the syntax error? The backslash is escaping only one of the
line termination characters which causes grief for the string continuation.
Of all the functional test files in Zope3, only those in
app/browser/form/ftests have the MSDOS line endings.
Am I the only one seeing this failure? Are *nix testers having any problems?
Should all Zope3 files stick with the UNIX line-ending convention of a
single newline? I can strip the carriage returns myself for now.
[An aside: does unittest use readline() to build the test suite? If so,
should it be using 'U' recently introduced for PEP 278?]
Snip, snip, back to testing,
Dave Harris
More information about the Zope3-dev
mailing list