diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-03-21 23:07:59 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-03-21 23:07:59 (GMT) |
commit | 24a41911602bf98e853278ef4bb8b4fb41c0ac8c (patch) | |
tree | 2e9dd92e5d108a655b9a281bc25382ca4a1a0cd8 /Lib/doctest.py | |
parent | c392b570db0df5a11771921865a65d69646aa24b (diff) | |
download | cpython-24a41911602bf98e853278ef4bb8b4fb41c0ac8c.zip cpython-24a41911602bf98e853278ef4bb8b4fb41c0ac8c.tar.gz cpython-24a41911602bf98e853278ef4bb8b4fb41c0ac8c.tar.bz2 |
Changed doctest to run tests in alphabetic order of name.
This makes verbose-mode output easier to dig thru, and removes an accidental
dependence on the order of dict.items() (made visible by recent changes to
dictobject.c).
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 4e80f10..270e308 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -813,7 +813,12 @@ see its docs for details. raise TypeError("Tester.rundict: d must support .items(); " + `d`) f = t = 0 - for thisname, value in d.items(): + # Run the tests by alpha order of names, for consistency in + # verbose-mode output. + names = d.keys() + names.sort() + for thisname in names: + value = d[thisname] if type(value) in (_FunctionType, _ClassType): f2, t2 = self.__runone(value, name + "." + thisname) f = f + f2 @@ -832,7 +837,12 @@ see its docs for details. savepvt = self.isprivate try: self.isprivate = lambda *args: 0 - for k, v in d.items(): + # Run the tests by alpha order of names, for consistency in + # verbose-mode output. + keys = d.keys() + keys.sort() + for k in keys: + v = d[k] thisname = prefix + k if type(v) is _StringType: f, t = self.runstring(v, thisname) |