Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tests to pass without XBR dependencies #1579

Closed
yan12125 opened this issue Jun 15, 2022 · 5 comments · Fixed by #1580
Closed

Allow tests to pass without XBR dependencies #1579

yan12125 opened this issue Jun 15, 2022 · 5 comments · Fixed by #1580

Comments

@yan12125
Copy link
Contributor

For version 22.5.1, tests fail if XBR dependencies are not installed:

Test failures
$ USE_TWISTED=1 PYTHONPATH=.:build/lib.linux-x86_64-3.10 trial autobahn
(...omitted...)
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/twisted/trial/runner.py", line 598, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python3.10/site-packages/twisted/python/modules.py", line 390, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python3.10/site-packages/twisted/python/reflect.py", line 298, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/usr/lib/python3.10/site-packages/twisted/python/reflect.py", line 245, in _importAndCheckStack
    raise excValue.with_traceback(excTraceback)
  File "/build/python-autobahn/src/autobahn-22.5.1/autobahn/xbr/test/test_xbr_frealm.py", line 13, in <module>
    from autobahn.xbr._secmod import SecurityModuleMemory, EthereumKey
  File "/build/python-autobahn/src/autobahn-22.5.1/autobahn/xbr/_secmod.py", line 35, in <module>
    from eth_account.account import Account
builtins.ModuleNotFoundError: No module named 'eth_account'

autobahn.xbr.test.test_xbr_frealm
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/twisted/trial/runner.py", line 598, in loadPackage
    module = modinfo.load()
  File "/usr/lib/python3.10/site-packages/twisted/python/modules.py", line 390, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/usr/lib/python3.10/site-packages/twisted/python/reflect.py", line 298, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/usr/lib/python3.10/site-packages/twisted/python/reflect.py", line 245, in _importAndCheckStack
    raise excValue.with_traceback(excTraceback)
  File "/build/python-autobahn/src/autobahn-22.5.1/autobahn/xbr/test/test_xbr_secmod.py", line 37, in <module>
    from py_eth_sig_utils.eip712 import encode_typed_data
builtins.ModuleNotFoundError: No module named 'py_eth_sig_utils'

autobahn.xbr.test.test_xbr_secmod
-------------------------------------------------------------------------------

Could you consider allowing tests to pass without XBR dependencies? For example, some other tests under autobahn/xbr first do from autobahn.xbr import HAS_XBR, and then import other XBR dependencies only when HAS_XBR is True. Relevant tests are also skipped if HAS_XBR is False.

I'm one of maintainers of official Arch Linux package python-autobahn. Maintaining XBR dependencies is a burden, so no related dependencies are picked into official repositories yet. I didn't use AUTOBAHN_STRIP_XBR introduced in #1371, so that users can still use autobahn.xbr if they installed necessary dependencies from unofficial packages.

@oberstet
Copy link
Contributor

yeah, the XBR dependencies can be painful, this is because Ethereum is a complete new world, everything is moving quite fast, and is hashed out on the fly;) It's just the early phase of ground breaking new tech - unavoidable pain during birth.

rgd the issue: if someone comes up with a PR, sure! otherwise, just package without testing.

@oberstet
Copy link
Contributor

one more hint rgd this XBR stuff: this is very new and experimental, but I'd expect it to become more important to Autobahn/WAMP users looking forward (it is not relevant for users of only the WebSocket stuff in Autobahn). eg it will allow to create WAMP realms shared between and hosted by multiple parties, and also to define and share WAMP API definitions ...

@yan12125
Copy link
Contributor Author

if someone comes up with a PR, sure! otherwise, just package without testing.

Sometimes Arch Linux comes with newer dependencies or newer Python versions. Usually we enable tests to ensure compatibility. I will try to make a PR to skip tests.

I'd expect it to become more important to Autobahn/WAMP

Sounds interesting. The program I use (buildbot) does use WAMP. I will check XBR dependencies again at that time. Hopefully packages for XBR dependencies will be easier to maintain then :)

@oberstet
Copy link
Contributor

Hopefully packages for XBR dependencies will be easier to maintain then :)

working on it;)

BB: +1 !! great project and people=)

To give a bit more preview, one thing that BB might indeed be interested in: formalizing their WAMP based BB APIs by writing schemas (in FlatBuffers IDL), and then profit by docs / code generation, payload validation and (future) run-time interface reflection
Bildschirmfoto von 2022-05-31 20-30-21
Bildschirmfoto von 2022-05-31 20-30-35
Bildschirmfoto von 2022-05-31 20-31-56

the last screenshot is my ugly demo of auto rendering docs from WAMP APIs ... works via Jinja2 templates and a LMDB schema store, and with Crossbar.io as router (https://github.com/crossbario/crossbar-examples/blob/c67e99777ab7eb12cacab34957a245ce01d28cef/payload-validation/static/.crossbar/config.json#L105)

anyways, it is under development, not yet ready for prime time;)

@yan12125
Copy link
Contributor Author

Cool! While I'm more a buildbot user than a dev, I believe buildbot devs will be interested in those nice improvements as well :)

oberstet pushed a commit that referenced this issue Jun 17, 2022
* Allow tests to pass without XBR dependencies - fixes #1579
* Address review comments
* Fix test skipping notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants