Created
May 17, 2016 08:08
-
-
Save chfw/961dfc279d56a34d33eca8bbe9f168e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it's been challenging to do that simple task, which is put a print statement in the emptied module file. when it comes to testing, | |
the first block is to how to test the output? one solution is to mock sys.stdout, the other is to wrap print in a function and patch it. | |
the second block is the module is already loaded and won't be loaded again. Hence you need to reload it. for reload, py2 and py3 had a | |
difference in where the reload comes from. here is the code to get around. | |
try: | |
reload | |
except NameError: | |
from imp import reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment