From 083e8292ca797397f8bb491b28ff349cce1c7925 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:55:00 +0200 Subject: [PATCH] Publish coverage information also from envsitedir This is needed because otherwise we do not publish the coverage information of the unit tests, but only those coming from the aliBuild commands. --- alibuild_helpers/utilities.py | 4 ++++ tests/test_coverage.py | 7 +++++++ tox.ini | 6 ++++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/test_coverage.py diff --git a/alibuild_helpers/utilities.py b/alibuild_helpers/utilities.py index f0b4b123..33dfacad 100644 --- a/alibuild_helpers/utilities.py +++ b/alibuild_helpers/utilities.py @@ -29,6 +29,10 @@ class SpecError(Exception): asList = lambda x : x if type(x) == list else [x] +# This function is only needed to check the coverage of the testsuite +# is really happening and we did not made a mistake in tox.ini +def check_coverage(): + return True def resolve_store_path(architecture, spec_hash): """Return the path where a tarball with the given hash is to be stored. diff --git a/tests/test_coverage.py b/tests/test_coverage.py new file mode 100644 index 00000000..4dfcfb37 --- /dev/null +++ b/tests/test_coverage.py @@ -0,0 +1,7 @@ +import unittest +from alibuild_helpers.utilities import check_coverage + +class FooTest(unittest.TestCase): + def test_foo(self): + self.assertTrue(check_coverage()) + diff --git a/tox.ini b/tox.ini index ed710071..da3f14df 100644 --- a/tox.ini +++ b/tox.ini @@ -108,11 +108,13 @@ commands = coverage run --source={toxinidir} -a {toxinidir}/aliBuild init zlib touch zlib/foo coverage run --source={toxinidir} -a {toxinidir}/aliBuild -a {env:ARCHITECTURE} --no-system --disable GCC-Toolchain build zlib + coverage run --source={envsitepackagesdir} -a -m unittest discover {toxinidir}/tests [coverage:run] branch = True -omit = - */.tox/*/lib/* +include = + */alibuild*/* + */.tox/*/lib/*/alibuild_helpers/* [coverage:report] exclude_lines =