[Python-Dev] test_doctest failing, but perhaps by accident

Michael Hudson mwh21@cam.ac.uk
21 Mar 2001 22:01:15 +0000


"Tim Peters" <tim.one@home.com> writes:

> [Michael Hudson]
> > Yes.  Linux.
> >
> > I'm getting:
> >
> > We expected (repr): 'doctest.Tester.runstring.__doc__'
> > But instead we got: 'doctest.Tester.summarize.__doc__'
> 
> Same thing, then (Jeremy, *don't* use -r).
> 
> >> Does not fail in isolation.
> 
> > Indeed.
> 
> > How does doctest order it's tests?  I bet the changes just made to
> > dictobject.c make the order of dict.items() slightly unpredictable
> > (groan).
> 
> As just posted, doctest uses whatever .items() returns but probably
> shouldn't.  It's hard to see how the dictobject.c changes could
> affect that, but I have to agree they're the most likley suspect.

> I'll back those out locally and see whether the problem persists.

Fixes things here.

Oooh, look at this:

$ ../../python 
Python 2.1b2 (#3, Mar 21 2001, 21:29:14) 
[GCC 2.95.1 19990816/Linux (release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import doctest
>>> doctest.Tester.__dict__.keys()
['__init__', '__doc__', 'run__test__', '_Tester__record_outcome', 'runstring', 'summarize', '_Tester__runone', 'rundict', 'merge', 'rundoc', '__module__']
>>> doctest.testmod(doctest)
(0, 53)
>>> doctest.Tester.__dict__.keys()
['__init__', '__doc__', 'run__test__', 'summarize', '_Tester__runone', 'rundict', 'merge', 'runstring', 'rundoc', '_Tester__record_outcome', '__module__']

Indeed:

$ ../../python 
Python 2.1b2 (#3, Mar 21 2001, 21:29:14) 
[GCC 2.95.1 19990816/Linux (release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import doctest
>>> doctest.Tester.__dict__.keys()
['__init__', '__doc__', 'run__test__', '_Tester__record_outcome', 'runstring', 'summarize', '_Tester__runone', 'rundict', 'merge', 'rundoc', '__module__']
>>> doctest.Tester.__dict__['__doc__'] = doctest.Tester.__dict__['__doc__']
>>> doctest.Tester.__dict__.keys()
['__init__', '__doc__', 'run__test__', 'summarize', '_Tester__runone', 'rundict', 'merge', 'runstring', 'rundoc', '_Tester__record_outcome', '__module__']

BUT, and this is where I give up:

    This has always happened!  It even happens with Python 1.5.2!

it just makes a difference now.  So maybe it's something else entirely.

Cheers,
M.

-- 
  MARVIN:  Do you want me to sit in a corner and rust, or just fall
           apart where I'm standing?
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 2