diff mbox

[2/2] group junit like output by filenames

Message ID 1403531763-13441-3-git-send-email-tigran.mkrtchyan@desy.de (mailing list archive)
State New, archived
Headers show

Commit Message

Mkrtchyan, Tigran June 23, 2014, 1:56 p.m. UTC
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 nfs4.1/testmod.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index 661aed0..32f51a9 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -97,10 +97,11 @@  class Test(object):
     _funct_result = Result(DEP_FUNCT, default=True)
     __re = re.compile(r'(\D*)(\d*)(.*)')
 
-    def __init__(self, function, module=""):
+    def __init__(self, suite, function, module=""):
         """Needs function to be run"""
         self.runtest = function
         self.name = function.__name__
+        self.suite = suite
         if module:
             self.fullname = module.split('.')[-1] + '.' + self.name
         else:
@@ -347,7 +348,7 @@  def createtests(testdir):
         for attr in dir(mod):
             if attr.startswith("test"):
                 f = getattr(mod, attr)
-                tests.append(Test(f, testmod))
+                tests.append(Test(testfile, f, testmod))
     # Reduce doc string info into format easier to work with
     used_codes = {}
     flag_dict = {}
@@ -451,8 +452,8 @@  def xml_printresults(tests, file_name, suite='all'):
         for t in tests:
             testcase = doc.createElement("testcase")
             testsuite.appendChild(testcase)
-            testcase.setAttribute("name", str(t))
-            testcase.setAttribute("classname", suite)
+            testcase.setAttribute("name", t.name)
+            testcase.setAttribute("classname", t.suite)
             testcase.setAttribute("time", str(t.time_taken))
 
             total_time += t.time_taken