[Python-Dev] test_descrtut failing

Jack Jansen jack@oratrix.nl
Sun, 09 Sep 2001 00:46:22 +0200


Recently, Guido van Rossum <guido@python.org> said:
> You said that when you run the test standalone the type names are
> different.  *How* do you run it standalone?  If I run it like this:
> 
>     ./python Lib/test/test_descrtut.py
> 
> it works fine (and -v works here too).  But if I run it like this:
> 
>     ./python
>     >>> import test.test_descrtut	# this does not run the tests!
>     >>> test.test_descrtut.test_main()	# this does!

Indeed, I run it the second way (no command line on the Mac,
remember:-).

The fun thing is that if I run it completely standalone (by dragging
test_descrtut.py to the interpreter, the test can handle this
situation) it works fine! So, there must be something wrong with
either the test framework (or maybe this re-import trick?) that
doesn't work as expected on the Mac.

Maybe test_regrtest can be thought which tests use unittest or
doctest, and not try to be helpful in those cases?

For now I've just put a note in the readme file for MacPython that
this test is expected to fail, but I'd like to fix it eventually, of
course.

I have another gripe with the new unittest stuff (this is the first
time I've seen the doctest thing, never knew it was there!), and
that's that most of the test failures are difficult to
interpret. Whereas the old-style tests simply "print math.sin(math.pi)"
and tell you they expected the output to be 0 but got -1 in stead the
unittest-based tests often don't give that information.
Most of the unittest-based tests use only failUnless/assert_ in stead
of the higher-level functions, i.e. test_time uses things like
        self.assert_(time.ctime(self.t)
                 == time.asctime(time.localtime(self.t)))
where the test results would be a lot easier to interpret if they used
      self.assertEqual(time.ctime(self.t),
		time.asctime(time.localtime(self.t)),
		"ctime(T) != asctime(localtime(T)")
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm