unit testing - unittest in python: ignore an import from the code I want to test -


I have a Python program that imports pythoncom (and uses pythoncom.CoCreateInstance from it) I want to make a lone without importing Python (so I can run a test on Linux too).

What are the options? Can I do the test without modifying the system?

which I have found so far:

  sys.modules ["pythoncom"] = "test" import module_that_import_pithonom  

its My problem with me is that if I have:

I will get:

  importError: a module name something.Something  

and sys.modules ["something.Something"] or Sys.modules ["pythoncom .something.something "] does not work.

Any thoughts?

You import to excluding blocks

.

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -