From cd91cfc82792d8193605e4c9912cdb02490dccc7 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Thu, 13 Jun 2024 23:22:30 +0800 Subject: [PATCH] enable python coverage (#149) Signed-off-by: Sun, Xuehao Signed-off-by: chensuyue --- .../workflows/{container-build.yaml => container-build.yml} | 0 .github/workflows/docker/ut.dockerfile | 2 +- .../workflows/{megaservice-test.yaml => megaservice-test.yml} | 0 .github/workflows/scripts/test_ut.sh | 3 ++- 4 files changed, 3 insertions(+), 2 deletions(-) rename .github/workflows/{container-build.yaml => container-build.yml} (100%) rename .github/workflows/{megaservice-test.yaml => megaservice-test.yml} (100%) diff --git a/.github/workflows/container-build.yaml b/.github/workflows/container-build.yml similarity index 100% rename from .github/workflows/container-build.yaml rename to .github/workflows/container-build.yml diff --git a/.github/workflows/docker/ut.dockerfile b/.github/workflows/docker/ut.dockerfile index 800e4786b..328984ff5 100644 --- a/.github/workflows/docker/ut.dockerfile +++ b/.github/workflows/docker/ut.dockerfile @@ -19,6 +19,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ wget RUN ln -sf $(which python3) /usr/bin/python -RUN python -m pip install --no-cache-dir pytest +RUN python -m pip install --no-cache-dir pytest pytest-cov WORKDIR / diff --git a/.github/workflows/megaservice-test.yaml b/.github/workflows/megaservice-test.yml similarity index 100% rename from .github/workflows/megaservice-test.yaml rename to .github/workflows/megaservice-test.yml diff --git a/.github/workflows/scripts/test_ut.sh b/.github/workflows/scripts/test_ut.sh index 3394e774f..887e996cd 100644 --- a/.github/workflows/scripts/test_ut.sh +++ b/.github/workflows/scripts/test_ut.sh @@ -13,7 +13,8 @@ if [ $test_name = 'mega' ]; then echo "run mega test" cd cores find . -name "*.yaml" -exec sh -c 'x="{}"; cp $x ./' \; - find . -name "test*.py" | sed 's,\.\/,python -m pytest -vs --disable-warnings ,g' > run.sh + comps_path=$(python -c 'import comps; print(comps.__path__[0])') + find . -name "test*.py" | sed "s,\.\/,python -m pytest --cov=\"${comps_path}\" --cov-append -vs --disable-warnings ,g" > run.sh bash run.sh 2>&1 | tee ${ut_log_name} else echo "run other test"