* 2009-12-25 10:23, Lennart Regebro wrote:
> Yes, we did. But now we try to get the deprecation warnings to show up in
> the correct place. And we could warn for the usage of some of the names,
> but in the message explain that doctest.py is deprecated.

What do you think about the attached patch (applied to the current trunk)?
It makes the tests quite noisy (each usage of DocTestSuite and DocFileSuite
raises a warning), but I think matches with what you wrote in the quoted
paragraph above.

Thanks,
Fabio
Index: src/zope/testing/doctest/__init__.py
===================================================================
--- src/zope/testing/doctest/__init__.py	(revisione 107149)
+++ src/zope/testing/doctest/__init__.py	(copia locale)
@@ -108,11 +108,6 @@
 warnings.filterwarnings("ignore", "is_private", DeprecationWarning,
                         __name__, 0)
 
-# Tell people to use the builtin module instead.
-warnings.warn('zope.testing.doctest is deprecated in favour of '
-              'the Python standard library doctest module', DeprecationWarning,
-               stacklevel=2)
-
 class UnusedFootnoteWarning(Warning):
     """Warn about a footnote that is defined, but never referenced."""
 
@@ -2381,6 +2376,9 @@
        A set of doctest option flags expressed as an integer.
     """
 
+    warnings.warn('zope.testing.doctest is deprecated in favour of the Python '
+        'standard library doctest module', DeprecationWarning, stacklevel=2)
+
     if test_finder is None:
         test_finder = DocTestFinder()
 
@@ -2512,6 +2510,9 @@
     encoding
       An encoding that will be used to convert the files to unicode.
     """
+    warnings.warn('zope.testing.doctest is deprecated in favour of the Python '
+        'standard library doctest module', DeprecationWarning, stacklevel=2)
+
     suite = unittest.TestSuite()
 
     # We do this here so that _normalize_module is called at the right
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to