File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed
testapp/handlers/commands Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11"""Simple message queue for commands and events (CQRS)"""
22
3- __version__ = "0.3.0 "
3+ __version__ = "0.3.1 "
44
55from queuebie .registry import MessageRegistry
66
Original file line number Diff line number Diff line change @@ -43,3 +43,13 @@ def create_user(context: CreateUser):
4343@message_registry .register_command (command = RaiseRuntimeError )
4444def 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
Original file line number Diff line number Diff line change 99from queuebie import MessageRegistry
1010from queuebie .exceptions import RegisterOutOfScopeCommandError
1111from queuebie .settings import get_queuebie_cache_key
12+ from testapp .handlers .commands .testapp import MyClass
1213from testapp .messages .commands .my_commands import CriticalCommand , DoSomething
1314from 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 ()
You can’t perform that action at this time.
0 commit comments