Skip to content
Advertisement

Python Unit test with i18 but without webapp2

I encountered a problem with unit tests when use i18 in my project. My project uses framewoks i18 and webapp2 The function uses the translation by i18. But when I test, I get the error – missing global variable request. For example it is:

JavaScript

and I have message:

JavaScript

I have a solution to this problem, but I do not like it. This is a crutch. How can you test my function without using framewoks on similarity webapp2

JavaScript

and well done!

Ran 2 tests in 0.047s

OK

But it’s not a good solution. How I can testing my function and dont use webapp2, etc?

Advertisement

Answer

just don’t test external code and patch your _lazy function

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement