From 10d99a345ebfd44d287bf8ee4bc76471c0a5ae31 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Sat, 23 Oct 2021 21:39:58 +0500 Subject: [PATCH 1/3] add codecov --- setup.py | 1 + tox.ini | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 81c9a81ccc..ccb1142fb6 100644 --- a/setup.py +++ b/setup.py @@ -268,6 +268,7 @@ def run(self): # packages included for build-testing everywhere core_testenv = [ 'pytest', + 'pytest-cov', # 'pytest-rerunfailures', # disabled 2020-08-28 for 'mock', 'cython', diff --git a/tox.ini b/tox.ini index 12811b8ba5..6d6b62665a 100644 --- a/tox.ini +++ b/tox.ini @@ -24,8 +24,26 @@ ignore = E203, # space before : exclude = .venv, .git, .tox, dist, doc, build, gensim/models/deprecated +[coverage:run] +source=gensim + +[coverage:report] +omit = + gensim/test/* + */__init__.py + +exclude_lines = + pragma: no cover + def __repr__ + def __str__ + raise AssertionError + raise NotImplementedError + if __name__ == .__main__.: + +ignore_errors = True + [pytest] -addopts = -rfxEXs --durations=20 --showlocals +addopts = -rfxEXs --durations=20 --showlocals --cov=gensim/ [testenv] From 83c373231d14892e494fde485ac8226b1e3c0fe1 Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Sat, 23 Oct 2021 21:56:35 +0500 Subject: [PATCH 2/3] add pytest-cov into multibuild --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 85e8637b86..ebe2201a6d 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -114,7 +114,7 @@ jobs: PLAT: x86_64 UNICODE_WIDTH: 32 MB_PYTHON_VERSION: ${{ matrix.python-version }} # MB_PYTHON_VERSION is needed by Multibuild - TEST_DEPENDS: Morfessor==2.0.2a4 python-levenshtein==0.12.0 visdom==0.1.8.9 pytest mock cython nmslib pyemd testfixtures scikit-learn pyemd + TEST_DEPENDS: Morfessor==2.0.2a4 python-levenshtein==0.12.0 visdom==0.1.8.9 pytest pytest-cov mock cython nmslib pyemd testfixtures scikit-learn pyemd DOCKER_TEST_IMAGE: multibuild/xenial_x86_64 TRAVIS_OS_NAME: ${{ matrix.travis-os-name }} SKIP_NETWORK_TESTS: 1 From 42e641f2f9e023b027faba3954cf145d369308ed Mon Sep 17 00:00:00 2001 From: Ivan Menshikh Date: Sun, 24 Oct 2021 15:24:38 +0500 Subject: [PATCH 3/3] upload coverage report form py38 (linux) --- .github/workflows/tests.yml | 11 ++++++++++- tox.ini | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 41a608ef90..0117fb2ea1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,9 +53,18 @@ jobs: run: ulimit -c unlimited -S # enable core dumps - name: Run tox tests run: tox -e ${{ matrix.tox }} + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-20.04' && matrix.python == '3.8' + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true + files: ./coverage.xml + verbose: true + + - name: Collect corefile if: ${{ failure() }} run: | pwd COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1) - if [[ -f "$COREFILE" ]]; then EXECFILE=$(gdb -c "$COREFILE" -batch | grep "Core was generated" | tr -d "\`" | cut -d' ' -f5); file "$COREFILE"; gdb -c "$COREFILE" "$EXECFILE" -x continuous_integration/debug.gdb -batch; fi + if [[ -f "$COREFILE" ]]; then EXECFILE=$(gdb -c "$COREFILE" -batch | grep "Core was generated" | tr -d "\`" | cut -d' ' -f5); file "$COREFILE"; gdb -c "$COREFILE" "$EXECFILE" -x continuous_integration/debug.gdb -batch; fi \ No newline at end of file diff --git a/tox.ini b/tox.ini index 6d6b62665a..d3feeccca0 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ exclude_lines = ignore_errors = True [pytest] -addopts = -rfxEXs --durations=20 --showlocals --cov=gensim/ +addopts = -rfxEXs --durations=20 --showlocals --cov=gensim/ --cov-report=xml [testenv]