package/python-unitest-xml-reporting: new package

Based on initial work from Nicolas Carrier
<nicolas.carrier@orolia.com>, with the following additions:

- Updated to a newer version
- Added proper license file handling
- Added runtime test case
- Restricted to Python 3.x

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Thomas Petazzoni
2021-11-02 23:21:26 +01:00
committed by Peter Korsgaard
parent 79e3cd1c78
commit 9d3428beca
7 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import unittest
import xmlrunner
class Test1(unittest.TestCase):
def test_something(self):
self.assertTrue(True)
if __name__ == '__main__':
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

View File

@@ -0,0 +1,23 @@
from tests.package.test_python import TestPythonPackageBase
import os
import time
class TestPythonPy3UnitTestXmlReporting(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_UNITTEST_XML_REPORTING=y
"""
sample_scripts = ["tests/package/sample_python_unittest_xml_reporting.py"]
timeout = 60
def test_run(self):
self.login()
self.check_sample_scripts_exist()
cmd = "%s %s" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
self.assertRunOk(cmd)
# check if some tests results in XML were generated
cmd = "ls -1 test-reports/TEST-Test1-*.xml"
self.assertRunOk(cmd)