[py-dev] Odd import issue with tests for compatibility modules.

Ian Bicking ianb at colorstudy.com
Wed Jun 15 19:40:33 CEST 2005


David Stanek wrote:
> The support for Python compatibility modules has been merged into trunk. I
> pulled the modules (doctest, optparse and testwrap) along with their tests
> from Python-r241. I was able to modify almost all of the tests to make
> sure they are testing the compat module and not the library module
> 
> However, I am having an issue with py/compat/testing/doctest2.py. The
> original  has a testing function that imports itself and then passtest
> that to a test.test_support.run_doctest method. To mimic that I tried
> passing the run_doctests method the following:
>  * sys.modules['__main__']
>  * test_doctest2 after a from py.__.compat.testing import test_doctest2
 >
> These do not work...well, all test are successful, but 2 are not being
> run. And they just happen to be the two that contain unicode characters.
> If I remove the characters the test will execute successfully. The test is
> not failing it is just not being run.
> 
> To debug I added a line to print out the __doc__ of the module, which is
> one of the tests that is not being executed. The string did NOT include
> the doctest code. So this seems to be an import thing and not something to
> do with unicode and/or doctest.

Would it make sense to force the import, like:

from py.compat import doctest
sys.modules['doctest'] = doctest

?  Maybe you're already doing this, but I wasn't sure.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the py-dev mailing list