Skip to content

Commit 70a4738

Browse files
committed
v0.3.1
1 parent 52dd526 commit 70a4738

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
* *0.3.1* (2025-03-19)
4+
* Added a paranoid-ish test to check that the import logic isn't breaking any testing functionality
5+
36
* *0.3.0* (2025-03-19)
47
* The whole queue iteration now is wrapped in a transaction atomic
58

queuebie/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Simple message queue for commands and events (CQRS)"""
22

3-
__version__ = "0.3.0"
3+
__version__ = "0.3.1"
44

55
from queuebie.registry import MessageRegistry
66

testapp/handlers/commands/testapp.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,13 @@ def create_user(context: CreateUser):
4343
@message_registry.register_command(command=RaiseRuntimeError)
4444
def raise_exception(context: RaiseRuntimeError):
4545
raise RuntimeError(context.error_msg)
46+
47+
48+
class MyClass:
49+
"""
50+
This is a test class since we observed the behaviour that in a similar setup, the "forced"
51+
import was breaking mocking.
52+
"""
53+
54+
def process(self):
55+
return 42

tests/test_registry.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from queuebie import MessageRegistry
1010
from queuebie.exceptions import RegisterOutOfScopeCommandError
1111
from queuebie.settings import get_queuebie_cache_key
12+
from testapp.handlers.commands.testapp import MyClass
1213
from testapp.messages.commands.my_commands import CriticalCommand, DoSomething
1314
from testapp.messages.events.my_events import (
1415
SomethingHappened,
@@ -191,3 +192,16 @@ def test_message_autodiscover_load_handlers_from_cache_dummy_cache(*args):
191192

192193
assert len(commands) == 0
193194
assert len(events) == 0
195+
196+
197+
@mock.patch.object(MyClass, "process")
198+
def test_registry_forced_import_doesnt_break_mocking(mocked_process):
199+
"""
200+
This is a test for ensuring that the "forced" import isn't breaking mocking features.
201+
"""
202+
203+
def my_func():
204+
return MyClass().process()
205+
206+
my_func()
207+
mocked_process.assert_called_once()

0 commit comments

Comments
 (0)