Rev 3202: Better test ids for bzrlib/doc/api doc tests. in file:///v/home/vila/src/bzr/experimental/selftest/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Jan 21 11:18:32 GMT 2008
At file:///v/home/vila/src/bzr/experimental/selftest/
------------------------------------------------------------
revno: 3202
revision-id:v.ladeuil+lp at free.fr-20080121111827-q19d8fx8t9le47os
parent: v.ladeuil+lp at free.fr-20080121105102-j5q7nmtbqw3vbrle
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: selftest
timestamp: Mon 2008-01-21 12:18:27 +0100
message:
Better test ids for bzrlib/doc/api doc tests.
* bzrlib/doc/api/__init__.py:
(test_suite): Provides a better id than 'branch_txt' when creating
a DocFileCase for bzrlib/doc/api/branch.txt.
modified:
bzrlib/doc/api/__init__.py __init__.py-20051224020744-7b87d590843855bc
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
-------------- next part --------------
=== modified file 'bzrlib/doc/api/__init__.py'
--- a/bzrlib/doc/api/__init__.py 2006-10-05 05:37:25 +0000
+++ b/bzrlib/doc/api/__init__.py 2008-01-21 11:18:27 +0000
@@ -26,7 +26,9 @@
import doctest
import os
-
+
+from bzrlib import tests
+
def test_suite():
dir_ = os.path.dirname(__file__)
if os.path.isdir(dir_):
@@ -35,4 +37,15 @@
candidates = []
scripts = [candidate for candidate in candidates
if candidate.endswith('.txt')]
- return doctest.DocFileSuite(*scripts)
+ suite = doctest.DocFileSuite(*scripts)
+ # DocFileCase reduces the test id to the base file name, we want more
+ for t in tests.iter_suite_tests(suite):
+ def make_new_test_id():
+ # While complying with the rule that a test id is
+ # <module>.<class>.<method>[(<param>+)], this does not represent
+ # the python names for class and method but should give enough
+ # hints to find back the source of a failing test.
+ new_id = '%s.DocFileCase.DocFileTest(%s)' % ( __name__, t)
+ return lambda: new_id
+ t.id = make_new_test_id()
+ return suite
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2008-01-21 10:51:02 +0000
+++ b/bzrlib/tests/__init__.py 2008-01-21 11:18:27 +0000
@@ -2852,7 +2852,7 @@
print '**failed to get doctest for: %s\n%s' % (mod, e)
raise
if keep_only is not None:
- # DocTest may used ids which doesn't contain the module name
+ # DocTests may use ids which doesn't contain the module name
doc_suite = filter_suite_by_id_list(doc_suite, keep_only)
suite.addTest(doc_suite)
More information about the bazaar-commits
mailing list