def test_test_results(self):
        try:
            rootdir = tempfile.mkdtemp()

            for filename in ['test1.xml', 'test2.xml', 'foo.bar']:
                result_file = os.path.join(rootdir, filename)
                with open(result_file, 'w') as fhand:
                    fhand.write('<testsuites tests="5" failures="3" errors="1" time="35" name="AllTests"></testsuites>')
            results = catkin_test_results.test_results(rootdir)
            self.assertEqual({'test1.xml': (5, 1, 3), 'test2.xml': (5, 1, 3)}, results)
        finally:
            shutil.rmtree(rootdir)
Beispiel #2
0
    def test_test_results(self):
        try:
            rootdir = tempfile.mkdtemp()

            for filename in ['test1.xml', 'test2.xml', 'foo.bar']:
                result_file = os.path.join(rootdir, filename)
                with open(result_file, 'w') as fhand:
                    fhand.write(
                        '<testsuites tests="5" failures="3" errors="1" time="35" name="AllTests"></testsuites>'
                    )
            results = catkin_test_results.test_results(rootdir)
            self.assertEqual({
                'test1.xml': (5, 1, 3),
                'test2.xml': (5, 1, 3)
            }, results)
        finally:
            shutil.rmtree(rootdir)
Beispiel #3
0
 def test_test_results_detail(self):
     try:
         oldstdout = sys.stdout
         sys.stdout = StringIO()
         rootdir = tempfile.mkdtemp()
         test_xml = 'test.xml'
         test_suites = '<testsuites tests="5" failures="3" errors="1" time="35" name="AllTests"></testsuites>'
         result_file = os.path.join(rootdir, test_xml)
         with open(result_file, 'w') as fhand:
             fhand.write(test_suites)
         results = catkin_test_results.test_results(rootdir, show_verbose=True)
         self.assertEqual({test_xml: (5, 1, 3)}, results)
         summary = sys.stdout.getvalue()
         self.assertTrue(test_xml in summary, summary)
         self.assertTrue(test_suites in summary, summary)
     finally:
         shutil.rmtree(rootdir)
         sys.stdout = oldstdout
 def test_test_results_detail(self):
     try:
         oldstdout = sys.stdout
         sys.stdout = StringIO()
         rootdir = tempfile.mkdtemp()
         test_xml = 'test.xml'
         test_suites = '<testsuites tests="5" failures="3" errors="1" time="35" name="AllTests"></testsuites>'
         result_file = os.path.join(rootdir, test_xml)
         with open(result_file, 'w') as fhand:
             fhand.write(test_suites)
         results = catkin_test_results.test_results(rootdir,
                                                    show_verbose=True)
         self.assertEqual({test_xml: (5, 1, 3)}, results)
         summary = sys.stdout.getvalue()
         self.assertTrue(test_xml in summary, summary)
         self.assertTrue(test_suites in summary, summary)
     finally:
         shutil.rmtree(rootdir)
         sys.stdout = oldstdout