Fixed #5442 -- Added Jython workaround in django.test._doctest. Thanks, leo.soto@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-09-14 17:17:37 +00:00
parent 42f4f44356
commit 933cda3749
1 changed files with 9 additions and 1 deletions

View File

@ -105,6 +105,14 @@ import unittest, difflib, pdb, tempfile
import warnings import warnings
from StringIO import StringIO from StringIO import StringIO
if sys.platform.startswith('java'):
# On Jython, isclass() reports some modules as classes. Patch it.
def patch_isclass(isclass):
def patched_isclass(obj):
return isclass(obj) and hasattr(obj, '__module__')
return patched_isclass
inspect.isclass = patch_isclass(inspect.isclass)
# Don't whine about the deprecated is_private function in this # Don't whine about the deprecated is_private function in this
# module's tests. # module's tests.
warnings.filterwarnings("ignore", "is_private", DeprecationWarning, warnings.filterwarnings("ignore", "is_private", DeprecationWarning,