Getting blank xunit result file(xml) after using nose.core.TestProgram?

42 views
Skip to first unread message

mountain

unread,
Jun 29, 2016, 3:34:26 PM6/29/16
to nose-users
I am using this code and I am getting xml file with this entry only ?
and I am using python v2.7 and nosetests v1.3.7

   
 <?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="0" errors="0" failures="0" skip="0"></testsuite>



My code is

   
    #!/usr/bin/env python
   
   
from nose.suite import ContextSuite
   
from nose.plugins.xunit import Xunit
   
from nose.plugins.plugintest import run_buffered as run
   
from nose.plugins.skip import SkipTest, Skip
   
import fnmatch
   
import os
   
from nose.loader import TestLoader
   
from nose.core import TestProgram
   
    file_pattern
= 'test_*.pyc'
    suite
= ContextSuite()
   
for root, dir_names, file_names in os.walk('.'):
       
for file_name in file_names:
           
if fnmatch.fnmatch(file_name, 'test_*.py'):
                file_pattern
= 'test_*.py'
               
break
        path
= 'ksa.tests.'
       
if root != '.':
            path
+= root.replace('/', '.')
            path
= '{0}.'.format(path.replace('...', '.'))
       
for test_case in fnmatch.filter(file_names, file_pattern):
            modname
= path + os.path.splitext(test_case)[0]
           
module = __import__(modname, globals(), locals(), ['1'])
            suite
.addTest(TestLoader().loadTestsFromModule(module))
    outfile
= os.path.join(os.path.dirname(__file__), 'nosetests.xml')
    argv
= ['nosetests', '-v', '--with-xunit',
           
'--xunit-file=%s' % outfile]
   
#run(argv=argv, plugins=[Xunit(), Skip()], suite=suite)
   
TestProgram(suite=suite, plugins=[Xunit(), Skip()], argv=argv)


So can you please tell what I am doing wrong here ?
Thanks for your consideration :)
Reply all
Reply to author
Forward
0 new messages