I have a module which is like so:
import A.b
import A.c
if name == "A":
load_some_settings()
in test.py
import A
# avoid load_some_settings()
Mocking doesn't work here as module is loaded before patching. I tried importing via imp.load_source however it loads the module twice, once with the actual name and then by the new name
Aucun commentaire:
Enregistrer un commentaire