On 1/17/22 13:37, Andrea Bolognani wrote: > On Mon, Jan 17, 2022 at 01:11:29PM +0100, Michal Prívozník wrote: >> On 1/14/22 17:49, Andrea Bolognani wrote: >>> This all works, but I wonder if we couldn't just create a trivial >>> shell script that behaves minimally the way we expect dnsmasq to, and >>> change our virFindFileInPath() mock so that it returns the absolute >>> path to it? That way we wouldn't need to implement any additional >>> mocking and the code would end up being much simpler. Diff below. >> >> I thought that we should avoid shell for new contributions: >> >> https://libvirt.org/programming-languages.html > > Fair enough. Python version below. > > > #!/usr/bin/env python3 > > import sys > > output = { > "--version": "Dnsmasq version 2.67", > "--help": "--bind-dynamic\n--ra-param", > } > > if len(sys.argv) != 2 or sys.argv[1] not in output: > print("invalid usage") > sys.exit(1) > > print(output[sys.argv[1]]) > And what exactly is the point? I'm failing to see why this would be any better than mocking virCommand. Can you elaborate please? Michal