[TIP] Mock plumbum commands
Paulo Matos
pmatos at linki.tools
Wed Mar 8 02:05:46 PST 2017
Hello,
I have an app using a bunch of plumbum commands. However I am finding it
tricky to properly test functions running plumbum commands. Has anyone
figured out the best way to mock these?
For example, if a function does something like:
def foo():
...
out = local['ls']()
...
I would probably like that during testing, ls will return always the
same thing and for that I need to mock it. But what would be the correct
approach?
Kind regards,
--
Paulo Matos
More information about the testing-in-python
mailing list