message_bus | A reliable and robust messaging bus for Ruby and Rack | Data Migration library
kandi X-RAY | message_bus Summary
kandi X-RAY | message_bus Summary
A reliable and robust messaging bus for Ruby and Rack
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of message_bus
message_bus Key Features
message_bus Examples and Code Snippets
Community Discussions
Trending Discussions on message_bus
QUESTION
I'm using dbus for IPC. In order to have exactly one bus throughout the livetime of my program I'm using a singleton here. For the sake of demonstration I'm connecting to NetworkManager but that could be exchanged. Furthermore, I'm using asyncio
for the entire project.
This is a minimalistic working example of the module that will highlight the problem described below:
ANSWER
Answered 2020-Oct-15 at 21:16From looking at this, looks like you're using a global variable which connects to something. Persistent connections are bound to an event loop. So if you want to continue using a global variable, the scope of the event loop fixture needs to match the scope of this variable.
I would redefine the event loop fixture to be session scoped, and create a session scoped fixture, depending on the event loop fixture, to initialize this global variable (by just calling get_bus
, I suppose). The second fixture is required to ensure proper initialization ordering - i.e. that the event loop is set up properly first.
Edit: The documentation of pytest-asyncio
says that event loops by default are test function scoped. Thus, they are being recreated in for each test. This default behavior can be simply overridden:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install message_bus
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page