In this Python project I'm working on I need to use a decorator in a method, but this decorator is only available in production environment and I need to test the class where it is used, so I first tried to mock the import as shown in How to mock an import but it didn't work for the decorator, I still get the error:
ImportError: No module named B
in the file I need to test.
I also tried to mock the decorator and pass it to the module as a dependency injection, but I get the error saying the decorator is not defined.
Any ideas?