Reputation: 1482
I am trying to write tests for a script that requires the win32 api, while developing on a mac. I would like to write tests for the portions that don't require win32, and run them on a mac, but I can't because the script, obviously, automatically imports all dependencies, including win32, which I don't have on my mac machine.
I have thought about faking an import in the test file. Since python doesn't import the same module twice and it only checks the name of the dependencies and not the contents. Is there anything less hacky that I can use to solve this problem?
Upvotes: 1
Views: 72
Reputation: 11039
Anything stopping you from using this?
try:
import win32api
except ImportError:
pass
Upvotes: 2