Django

Code

Ticket #5442: jython_isclass_workaround.patch

File jython_isclass_workaround.patch, 0.7 kB (added by leo.soto@gmail.com, 1 year ago)

Workaround for the bug until it's fixed on jython

  • django/test/_doctest.py

    old new  
    105105import warnings 
    106106from StringIO import StringIO 
    107107 
     108# On Jython isclass() reports some modules as classes. Patch it: 
     109def patch_isclass(isclass): 
     110    def patched_isclass(obj): 
     111        return isclass(obj) and hasattr(obj, '__module__') 
     112    return patched_isclass 
     113if sys.platform.startswith('java'): 
     114    inspect.isclass = patch_isclass(inspect.isclass) 
     115 
     116 
     117 
    108118# Don't whine about the deprecated is_private function in this 
    109119# module's tests. 
    110120warnings.filterwarnings("ignore", "is_private", DeprecationWarning,