From 65f7a8ba435e2e628a8a44e7c2882b245104b45c Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 1 May 2024 16:44:09 -0700 Subject: [PATCH] Update coverage call, don't install in editable mode in testing (#188) --- .github/workflows/HDMF_dev.yaml | 4 ++-- .github/workflows/run_coverage.yml | 16 +++++++++++----- CHANGELOG.md | 1 + pyproject.toml | 10 ++++------ tox.ini | 1 - 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/HDMF_dev.yaml b/.github/workflows/HDMF_dev.yaml index 47f03bff..eb6a4900 100644 --- a/.github/workflows/HDMF_dev.yaml +++ b/.github/workflows/HDMF_dev.yaml @@ -24,14 +24,14 @@ jobs: - name: Install HDMF_Zarr Requirements run: | python -m pip install -r requirements-dev.txt -r requirements.txt - pip install -e . + pip install . - name: Clone HDMF Dev Branch run: | git clone https://github.com/hdmf-dev/hdmf.git --recurse-submodules cd hdmf python -m pip install -r requirements-dev.txt -r requirements.txt - python -m pip install -e . + python -m pip install . cd .. - name: Run HDMF_Zarr Tests diff --git a/.github/workflows/run_coverage.yml b/.github/workflows/run_coverage.yml index a32ef05d..4e96604d 100644 --- a/.github/workflows/run_coverage.yml +++ b/.github/workflows/run_coverage.yml @@ -48,20 +48,26 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -r requirements-dev.txt -r requirements.txt -r requirements-opt.txt + python -m pip install -r requirements-dev.txt -r requirements.txt + + - name: Install optional dependencies + if: ${{ matrix.opt_req }} + run: python -m pip install -r requirements-opt.txt - name: Install package run: | - python -m pip install -e . # must install in editable mode for coverage to find sources + python -m pip install . python -m pip list + - name: Run tests and generate coverage report run: | - pytest --cov - python -m coverage xml # codecov uploader requires xml format - python -m coverage report -m + # coverage is configured in pyproject.toml + pytest --cov --cov-report=xml --cov-report=term # codecov uploader requires xml format + - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: fail_ci_if_error: true + file: ./coverage.xml env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9f3673..5c14973d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Enhancements * Added support for python 3.12. @mavaylon1 [#172](https://github.com/hdmf-dev/hdmf-zarr/pull/172) * Added support for forcing read of files without consolidated metadata using `mode=r-` in `ZarrIO`. @oruebel [#183](https://github.com/hdmf-dev/hdmf-zarr/pull/183) +- Updated testing to not install in editable mode and not run `coverage` by default. @rly [#188](https://github.com/hdmf-dev/hdmf-zarr/pull/188) ### Docs * Removed `linkable` from the documentation to keep in line with `hdmf-schema-language`. @mavaylon1 [#180](https://github.com/hdmf-dev/hdmf-zarr/pull/180) diff --git a/pyproject.toml b/pyproject.toml index ee1eaa40..56c63b7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,8 +62,6 @@ exclude = [".git_archival.txt"] [tool.hatch.build.targets.wheel] packages = ["src/hdmf_zarr"] -[tool.pytest.ini_options] -addopts = "--cov --cov-report html" [tool.codespell] skip = "htmlcov,.git,.mypy_cache,.pytest_cache,.coverage,*.pdf,*.svg,venvs,.tox,./docs/_build/*,*.ipynb" @@ -71,16 +69,16 @@ ignore-words-list = "datas" [tool.coverage.run] branch = true -source = ["src/"] -omit = [ - "src/hdmf_zarr/_due.py", -] +source = ["hdmf_zarr"] [tool.coverage.report] exclude_lines = [ "pragma: no cover", "@abstract" ] +omit = [ + "*/hdmf_zarr/_due.py", +] [tool.black] line-length = 120 diff --git a/tox.ini b/tox.ini index 4ca607de..4722b7c6 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ requires = pip >= 22.0 [testenv] download = True -usedevelop = True setenv = PYTHONDONTWRITEBYTECODE = 1 VIRTUALENV_python -m pip = 22.3.1