On 21 January 2013 16:23, Michael Hanselmann <[email protected]> wrote: > This patch factorizes “_RunXmList” and adds some tests. > > Signed-off-by: Michael Hanselmann <[email protected]> > --- > Makefile.am | 2 + > lib/hypervisor/hv_xen.py | 155 > ++++++++++++++---------- > test/data/xen-xm-list-4.0.1-dom0-only.txt | 2 + > test/data/xen-xm-list-4.0.1-four-instances.txt | 5 + > test/py/ganeti.hypervisor.hv_xen_unittest.py | 91 ++++++++++++++- > 5 files changed, 191 insertions(+), 64 deletions(-) > create mode 100644 test/data/xen-xm-list-4.0.1-dom0-only.txt > create mode 100644 test/data/xen-xm-list-4.0.1-four-instances.txt
Nice work, thank you. Only, I'm not sure about the fact that the tests contain parts of the data files, as they check the parsed results and compare them with hard-coded constants. Wouldn't it be better if the content of the data files was put in a list, as you did for testWrongLineFormat()? in this way it would be easier to keep the code in sync with the data. I don't mind the duplication as much as the distance between the two things to be kept sync. Bernardo
