From f875786ce338b329421f772b181e7183f0fcb333 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sat, 1 May 2021 17:15:06 +0200 Subject: [PATCH 1/2] test(functional): start tracking functional test coverage --- .github/workflows/test.yml | 6 ++++++ codecov.yml | 15 +++++++++++++++ tox.ini | 9 +++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01e604f92..8002d361a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,12 @@ jobs: env: TOXENV: ${{ matrix.toxenv }} run: tox + - name: Upload codecov coverage + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml + flags: ${{ matrix.toxenv }} + fail_ci_if_error: true coverage: runs-on: ubuntu-20.04 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..0a82dcd51 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + +comment: + layout: "diff,flags,files" + behavior: default + require_changes: yes + +github_checks: + annotations: true diff --git a/tox.ini b/tox.ini index 2b984daf4..5653270aa 100644 --- a/tox.ini +++ b/tox.ini @@ -74,8 +74,13 @@ omit = *tests* [testenv:cli_func_v4] deps = -r{toxinidir}/docker-requirements.txt -commands = pytest --script-launch-mode=subprocess tools/functional/cli {posargs} +commands = + pytest --cov gitlab --cov-report term --cov-report html --cov-report xml \ + --script-launch-mode=subprocess \ + tools/functional/cli {posargs} [testenv:py_func_v4] deps = -r{toxinidir}/docker-requirements.txt -commands = pytest tools/functional/api {posargs} +commands = + pytest --cov gitlab --cov-report term --cov-report html --cov-report xml \ + tools/functional/api {posargs} From dfa40c1ef85992e85c1160587037e56778ab49c0 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sat, 1 May 2021 17:44:08 +0200 Subject: [PATCH 2/2] style: clean up test run config --- tox.ini | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index 5653270aa..42dd63967 100644 --- a/tox.ini +++ b/tox.ini @@ -66,21 +66,22 @@ commands = python setup.py build_sphinx [testenv:cover] commands = - pytest --cov gitlab --cov-report term --cov-report html \ + pytest --cov --cov-report term --cov-report html \ --cov-report xml gitlab/tests {posargs} [coverage:run] omit = *tests* +source = gitlab + +[pytest] +script_launch_mode = subprocess [testenv:cli_func_v4] deps = -r{toxinidir}/docker-requirements.txt commands = - pytest --cov gitlab --cov-report term --cov-report html --cov-report xml \ - --script-launch-mode=subprocess \ - tools/functional/cli {posargs} + pytest --cov --cov-report xml tools/functional/cli {posargs} [testenv:py_func_v4] deps = -r{toxinidir}/docker-requirements.txt commands = - pytest --cov gitlab --cov-report term --cov-report html --cov-report xml \ - tools/functional/api {posargs} + pytest --cov --cov-report xml tools/functional/api {posargs}