tcalmant / ipopo

iPOPO: a Service-Oriented Component Model for Python
https://ipopo.readthedocs.io/
Apache License 2.0
69 stars 28 forks source link

Increase compatibility for IronPython #23

Closed tcalmant closed 9 years ago

tcalmant commented 10 years ago

It seems that the "try-except ImportError" trick to have a code working with both Python 2 and Python 3 doesn't work well with IronPython.

It seems the except block should intercept both ImportError and AttributeError exceptions, as shows this trace, running "run_remote.py" :

Traceback (most recent call last):
  File "C:\Program Files (x86)\IronPython 2.7\Lib\importlib\__init__.py", line 37, in import_module
  File "run_remote.py", line 316, in <module>
  File "run_remote.py", line 203, in main
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pelix\framework.py", line 1528, in create_framework
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pelix\framework.py", line 1337, in install_bundle
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pelix\framework.py", line 728, in install_bundle
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pelix\remote\dispatcher.py", line 60, in <module>
AttributeError: 'LightException' object has no attribute 'client'
tcalmant commented 10 years ago

Many tests don't pass in IronPython 2.7. Main problems are:

======================================================================
ERROR: testLifeCycle (tests.framework.test_bundles.BundlesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Thomas\Documents\Git\ipopo\tests\framework\test_bundles.py", line 109, in testLifeCycle
    bundle = self.context.install_bundle(self.test_bundle_name)
  File "C:\Users\Thomas\Documents\Git\ipopo\pelix\framework.py", line 1335, in install_bundle
    """
  File "C:\Users\Thomas\Documents\Git\ipopo\pelix\framework.py", line 726, in install_bundle
    module = importlib.import_module(name)
  File "C:\Program Files (x86)\IronPython 2.7\Lib\importlib\__init__.py", line 38, in import_module
    return sys.modules[name]
KeyError: tests.framework.simple_bundle

Seems to be too much for next release: prepare it for iPOPO 0.5.8 ?

tcalmant commented 9 years ago

Issues posted on IronPython project page:

tcalmant commented 9 years ago

Commit cece594bde66a543ce6445ac409226ffeeea5416 corrects the KeyError exception when reinstalling a bundle. Pelix framework tests now succeed on IronPython.

iPOPO nearly succeed: a SystemError exception is raised in test_requirements.testRequiresMap:

======================================================================
ERROR: Tests the behavior of RequiresMap
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Thomas\Documents\Git\ipopo\tests\ipopo\test_requirements.py", line 438, in testRequiresMap
    self.assertDictEqual({None: svc1}, compo.single_none,
  File "C:\Program Files (x86)\IronPython 2.7\Lib\unittest\case.py", line 823, in assertDictEqual
    diff = ('\n' + '\n'.join(difflib.ndiff(
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 60, in pformat
    return PrettyPrinter(indent=indent, width=width, depth=depth).pformat(object)
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 119, in pformat
    self._format(object, sio, 0, 0, {}, 0)
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 137, in _format
    rep = self._repr(object, context, level - 1)
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 229, in _repr
    repr, readable, recursive = self.format(object, context.copy(),
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 242, in format
    return _safe_repr(object, context, maxlevels, level)
  File "C:\Program Files (x86)\IronPython 2.7\Lib\pprint.py", line 284, in _safe_repr
    for k, v in _sorted(object.items()):
SystemError: Object reference not set to an instance of an object.

Also, any test about ConfigAdmin raises the following exception:

Traceback (most recent call last):
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\core.py", line 62, in run
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 177, in __call__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 224, in run
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 177, in __call__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 224, in run
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 177, in __call__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\suite.py", line 224, in run
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\case.py", line 45, in __call__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\proxy.py", line 128, in addError
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\plugins\manager.py", line 99, in __call__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\plugins\manager.py", line 141, in chain
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\plugins\logcapture.py", line 240, in formatLogRecords
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\util.py", line 650, in safe_str
  File "nosetests", line 8, in <module>                                                                               
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\core.py", line 118, in __init__
  File "C:\Program Files (x86)\IronPython 2.7\Lib\unittest\main.py", line 93, in __init__
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\core.py", line 207, in runTests
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\case.py", line 138, in run
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\nose-1.3.4-py2.7.egg\nose\plugins\logcapture.py", line 233, in formatError
UnicodeDecodeError: ('unknown', u'\xe8', 0, 1, '')                                                                    
tcalmant commented 9 years ago

Commit fd34a553080aee01afa025fb3f1597326db37b69 corrects the ConfigAdmin error: the exception was raised because a locale-aware error message was logged and captured by nose.

tcalmant commented 9 years ago

From commit e9b9613bb709398b679478e7d41a5548aa044080, all Pelix/iPOPO tests pass with IronPython !

Tests of remote services HTTP transports are skipped, as they are using multiprocessing, which isn't supported in IronPython.