[virt-tools-list] [PATCH virt-manager 06/14] tests: xmlparse: refactor method for generating out file path

Marc Hartmayer mhartmay at linux.ibm.com
Tue Feb 26 09:56:36 UTC 2019


Refactor method for generating out file path. It will be used in a
upcoming patch.

Signed-off-by: Marc Hartmayer <mhartmay at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
 tests/xmlparse.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index df6f022eaf57..2dbaf24ce434 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -81,9 +81,17 @@ class XMLParseTest(unittest.TestCase):
             return self._set_and_check(obj, name, initval, *args)
         return check
 
+    def _gen_outfile_path(self, basename):
+        """
+        Returns relative path to the file containing the expected XML
+        output
+
+        """
+        return "tests/xmlparse-xml/{!s}-out.xml".format(basename)
+
     def _get_test_content(self, basename, kvm=False):
         infile = "tests/xmlparse-xml/%s-in.xml" % basename
-        outfile = "tests/xmlparse-xml/%s-out.xml" % basename
+        outfile = self._gen_outfile_path(basename)
         guest = virtinst.Guest(kvm and self.kvmconn or self.conn,
                                parsexml=open(infile).read())
         return guest, outfile
-- 
2.17.0




More information about the virt-tools-list mailing list