From 6f8470ff090622b69f96b83f90e98ccd9932b30b Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sun, 20 Mar 2022 23:08:11 -0500 Subject: [PATCH 1/2] CI: add codecov --- .codecov.yml | 2 +- .coveragerc | 21 +++++++++++++++++++++ .github/workflows/ci.yml | 14 +++++++++----- requirements-dev.txt | 1 + setup.cfg | 4 +++- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 335ed5828..c241a31d0 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -9,4 +9,4 @@ coverage: target: 1 patch: false changes: false -comment: off +comment: false diff --git a/.coveragerc b/.coveragerc index 1d4f8520e..818b11b22 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,3 +3,24 @@ include = */asv/* branch = True disable_warnings = include-ignored + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if self\.debug + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + + # Don't complain about abstract methods, they aren't run: + @(abc\.)?abstractmethod diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b30fb56f7..04e15241b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,14 +28,18 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: python -m pip install -r requirements-dev.txt - - name: Install asv - run: pip install . + run: pip install .[test] - name: Run tests - run: python -m pytest -v --timeout=1800 --durations=20 test + run: python -m pytest -v --cov=asv --cov-report=xml + + - uses: codecov/codecov-action@v2 + with: + files: ./coverage.xml + flags: unittests + name: codecov-asv + verbose: true docs: runs-on: ubuntu-latest diff --git a/requirements-dev.txt b/requirements-dev.txt index dd75d36bd..d927b8c3f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -13,6 +13,7 @@ selenium pytest-xdist pytest-rerunfailures>=10.0 pytest-timeout +pytest-cov feedparser python-hglib flake8 diff --git a/setup.cfg b/setup.cfg index e70787675..da3c327ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,7 @@ test = pytest-xdist pytest-timeout pytest-rerunfailures>=10.0 + pytest-cov filelock virtualenv numpy @@ -57,7 +58,8 @@ console_scripts = asv = asv.__main__:main [tool:pytest] -addopts=-p no:logging +addopts=-p no:logging -n 2 --timeout=1800 --durations=20 +testpaths = test [flake8] max-line-length = 99 From bd5bd5c81ece6d1d4e4a988284f82d25ac13810a Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sun, 20 Mar 2022 23:20:31 -0500 Subject: [PATCH 2/2] use single worker --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index da3c327ef..9309a1650 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,7 +58,7 @@ console_scripts = asv = asv.__main__:main [tool:pytest] -addopts=-p no:logging -n 2 --timeout=1800 --durations=20 +addopts=-p no:logging --timeout=1800 --durations=20 testpaths = test [flake8]