launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03189
[Merge] lp:~allenap/launchpad/sensible-test-paths-for-doctests into lp:launchpad
Gavin Panella has proposed merging lp:~allenap/launchpad/sensible-test-paths-for-doctests into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/launchpad/sensible-test-paths-for-doctests/+merge/56184
This makes docttest selection with bin/test more predicatable, and
improves the readability of the output.
--
https://code.launchpad.net/~allenap/launchpad/sensible-test-paths-for-doctests/+merge/56184
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/sensible-test-paths-for-doctests into lp:launchpad.
=== modified file 'lib/canonical/launchpad/testing/systemdocs.py'
--- lib/canonical/launchpad/testing/systemdocs.py 2011-04-01 16:24:04 +0000
+++ lib/canonical/launchpad/testing/systemdocs.py 2011-04-04 14:54:33 +0000
@@ -89,7 +89,7 @@
record.levelname, record.name, self.format(record))
-def LayeredDocFileSuite(*args, **kw):
+def LayeredDocFileSuite(*paths, **kw):
"""Create a DocFileSuite, optionally applying a layer to it.
In addition to the standard DocFileSuite arguments, the following
@@ -134,15 +134,18 @@
kw['tearDown'] = tearDown
layer = kw.pop('layer', None)
- suite = doctest.DocFileSuite(*args, **kw)
+ suite = doctest.DocFileSuite(*paths, **kw)
if layer is not None:
suite.layer = layer
- # DocFileTest insists on using the basename of the file as the test
- # ID. This causes conflicts when two doctests have the same filename, so
- # we patch the id() method on the test cases.
for test in suite:
- test.id = partial(os.path.normpath, test._dt_test.filename)
+ # doctest._module_relative_path() does not normalize paths. To make
+ # test selection simpler and reporting easier to read, normalize here.
+ test._dt_test.filename = os.path.normpath(test._dt_test.filename)
+ # doctest.DocFileTest insists on using the basename of the file as the
+ # test ID. This causes conflicts when two doctests have the same
+ # filename, so we patch the id() method on the test cases.
+ test.id = partial(lambda test: test._dt_test.filename, test)
return suite