Can I “fake” a package (or at least a module) in python for testing purposes?
Sure. Define a class, put the stuff you need inside that, assign the class to sys.modules[“classname”]. class fakemodule(object): @staticmethod def method(a, b): return a+b import sys sys.modules[“package.module”] = fakemodule You could also use a separate module (call it fakemodule.py): import fakemodule, sys sys.modules[“package.module”] = fakemodule