[Python-projects] logilab-common test issues

Marien Zwart marienz at gentoo.org
Fri Mar 2 01:08:27 CET 2007


Hi,

Trying to get logilab-common-0.21.2 to pass its tests using the
"pytest" runner I ran into a few problems (other than the fact it's
not exiting with a nonzero status on failure, which I have hacked
around for now):

Because of the place option parsing happens pytest relies on there
being exactly one directory called "test" or "tests" somewhere below
the current directory. The "pytest" main script walks down from the
current directory and calls testlib.main on every directory called
test or tests it finds. This main function then (re)parses the
arguments and runs the tests. This is especially annoying for --help
(which does nothing if there is no test or tests dir below the current
one) or -t (specify testdir explicitly, which does nothing if there is
no test or tests dir below the current one and runs the tests more
than once if there is more than one).

fileutils.abspath_listdir has a doctest that relies on /home
containing exactly the directories "adim", "alf", "arthur" and "auc".
I'm guessing this should either not be picked up as a doctest or not
rely on those directories being there (and no others).

For some reason I have not been able to determine the unittest_testlib
output capture tests fail if I run pytest with the output redirected
to a file. I get (reformatted and with the long strings of "---"
shortened a bit for linewrapping):

======================================================================
FAIL: test_both_capture (unittest_testlib.OutErrCaptureTC)
----------------------------------------------------------------------
Traceback (most recent call last):              
  File "/usr/lib/python2.5/site-packages/logilab/common/testlib.py",
      line 781, in _proceed                                      
    testfunc(*args, **kwargs)                   
  File "unittest_testlib.py", line 373, in test_both_capture
    self.assertEqual(captured_out.strip(), "bar")
AssertionError: '-----------------------------\n
Executing unittest_modutils\n\n
-------------------------------------------------------------------------\n
Executing unittest_patricia\n\n
-------------------------------------------------------------------------\n
Executing unittest_shellutils\n\n
-------------------------------------------------------------------------\n
Executing unittest_table\n\n
-------------------------------------------------------------------------\n
Executing unittest_testlib\nbar' != 'bar'

The first bar of "---"s was not shortened by me. I'm assuming this is
buffered output but I have not been able to make it go away (I tried
adding a flush() to FDCapture before it dups the fd but that did not
seem to fix it). The other output capturing tests fail in a similar
way if this one is skipped.

-- 
Marien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20070302/932b910a/attachment.pgp 


More information about the Python-Projects mailing list