I've Flask application and I would like to write some unit tests. Structure of my app:
In my init.py file I've some code like this:
...
app = app_factory(name=name)
...
message_listener = multiprocessing.Process(target=rabbit_client.subscriber_with_restarts, args=[rmq_queue])
message_listener.start()
...
which runs RabbitMQ listener forever. It's ok for application but not for unit tests. When I'm trying to import app variable from this module, rabbit listener runs. I've tried to patch it using mock.patch, but it doesn't work.
Aucun commentaire:
Enregistrer un commentaire