question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow tests to pass without XBR dependencies

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yan12125commented, Jun 17, 2022

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

0reactions
oberstetcommented, Jun 16, 2022

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;)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Isolating Dependencies in Tests Using Mocks and Stubs
In order to test a SUT (the class to be tested), a developer must make sure that the class's dependencies won't interfere with...
Read more >
Changelog — autobahn 22.8.1.dev1 documentation
fix: allow tests to pass without XBR dependencies (#1580). new: Flatbuffers IDL based WAMP payload validation (#1576). fix: restore autobahn.twisted.testing ...
Read more >
Unit testing methods with dependencies (with no interfaces)
I understand that if the Player implemented an interface, I could simply create a mock and pass it in the unit test with...
Read more >
Testing Dependencies: Fake It While You Make It
There are many ways to test usage of third-party dependencies. This article explores four approaches: direct interaction, stubbing, faking, ...
Read more >
Outsmarting Go Dependencies in Testing Code
When using Go 's testing infrastructure, tests that involve multiple modules can cause dependency cycles which are not allowed by the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found