I have a package that looks like this:
lcl
|
| - lcl
| - LCL.py
| - lunabuild.py
In the lunabuild module, there is a Lunabuild class. The Lunabuild class has a method Lunabuild.configure_jobs(). The LCL class imports lunabuild. It then uses it as a lazily instantiated property:
@property
def luna_build(self):
self._luna_build = lunabuild.Lunabuild()
the LCL class has a main() method that runs the Lunabuild.configure_jobs() method:
main(self)
try:
self.luna_build.configure_jobs()
except ValidationError:
...
except Exception, e:
return_code = 2
self.logger_exception(e)
I'm trying to patch configure_jobs to have a side_effect that raises an error, so that I can test that unknown errors are logged as expected.
I have been unable to figure out where to patch. it keeps telling me that it doesn't recognize the attribute, or that lunabuild has no configure_jobs attribute.
Aucun commentaire:
Enregistrer un commentaire