[elbe-devel] [PATCH 04/11] tests: test_xml: Add coverage to simple xml test
Olivier Dion
dion at linutronix.de
Mon Aug 17 18:20:13 CEST 2020
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/tests/test_xml.py | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index 03ff9c35..ae630087 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -10,6 +10,14 @@ import tempfile
from elbepack.directories import elbe_dir, elbe_exe
from elbepack.commands.test import ElbeTestCase, ElbeTestLevel
from elbepack.shellhelper import system
+from elbepack.cov import ElbeCoverage
+
+def fetch_initvm_coverage(uuid):
+ if uuid is not None:
+ system("%s control get_file %s .coverage .coverage.initvm" %
+ (elbe_exe, uuid))
+ ElbeCoverage.rename_files(".coverage.initvm", "/var/cache/elbe/devel", os.getcwd())
+ ElbeCoverage.merge(['.coverage.initvm'])
@unittest.skipIf(ElbeTestCase.level < ElbeTestLevel.INITVM,
"Test level not set to INITVM")
@@ -44,11 +52,9 @@ class TestSimpleXML(ElbeTestCase):
#for cmd in ("cdrom", "img", "sdk", "rebuild"):
# with self.subTest(cmd=cmd):
# system('%s check-build %s "%s"' % (elbe_exe, cmd, build_dir))
+ finally:
+ fetch_initvm_coverage(uuid)
- # pylint: disable=try-except-raise
- except:
- raise
- else:
# This is a tear down of the project, it's okay if it fails
system('%s control del_project %s' % (elbe_exe, uuid),
allow_fail=True)
@@ -77,10 +83,9 @@ class TestPbuilder(ElbeTestCase):
uuid = f.read()
os.chdir(build_dir)
system('%s pbuilder build --project %s' % (elbe_exe, uuid))
- # pylint: disable=try-except-raise
- except:
- raise
- else:
+ finally:
+ fetch_initvm_coverage(uuid)
+
# This is a tearDown of the project, it's okay if it fails
system('%s control del_project %s' % (elbe_exe, uuid),
allow_fail=True)
--
2.28.0
More information about the elbe-devel
mailing list