diff --git a/.github/codecov.yml b/.github/codecov.yml index 4fba1de2..5f6c394f 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -15,4 +15,5 @@ comment: branches: # branch names that can post comment - "main" ignore: + - "conftest.py" - "virtualizarr/tests" # ignore folders and all its contents diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2dcbc491..38fb4e49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,7 @@ jobs: - name: Running Tests run: | - python -m pytest --run-network-tests --cov-report=xml --verbose virtualizarr + python -m pytest --run-network-tests --verbose --cov=virtualizarr --cov-report=xml - name: Upload code coverage to Codecov uses: codecov/codecov-action@v3.1.4 diff --git a/.github/workflows/min-deps.yml b/.github/workflows/min-deps.yml index 7565cb16..c236a9ef 100644 --- a/.github/workflows/min-deps.yml +++ b/.github/workflows/min-deps.yml @@ -51,7 +51,7 @@ jobs: - name: Running Tests run: | - python -m pytest --cov-report=xml --verbose virtualizarr + python -m pytest --verbose --cov=virtualizarr --cov-report=xml - name: Upload code coverage to Codecov uses: codecov/codecov-action@v3.1.4 diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 910d7321..74867ea5 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -51,7 +51,7 @@ jobs: - name: Running Tests run: | - python -m pytest --cov-report=xml --verbose virtualizarr + python -m pytest --verbose --cov=virtualizarr --cov-report=xml - name: Upload code coverage to Codecov uses: codecov/codecov-action@v3.1.4 diff --git a/docs/contributing.md b/docs/contributing.md index 4d514780..45fc8599 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -20,13 +20,20 @@ that require downloading files over the network. Skip this if you want the test faster or you have no internet access: ```bash -pytest -m pytest --run-network-tests +python -m pytest --run-network-tests ``` -Further, we use the `pytest-cov` plugin to generate a test coverage report. By default, -a report showing lines missing coverage will be printed to the terminal. You may supply -additional options to `pytest` to generate other outputs, such as an HTML report (via -`--cov-report=html`). For all available options added by the `pytest-cov` plugin, run +Further, the `pytest-cov` plugin is a test dependency, so you can generate a test +coverage report locally, if you wish (CI will automatically do so). Here are some +examples: + +```bash +python -m pytest --cov=. # Terminal (text) report (--cov=term) +python -m pytest --cov=. --cov=term-missing # Terminal report showing missing coverage +python -m pytest --cov=. --cov=html # HTML report written to htmlcov/index.html +``` + +To see all available `pytest` options added by the `pytest-cov` plugin, run `python -m pytest -h`, or see the [pytest-cov documentation](https://pytest-cov.readthedocs.io/en/latest/readme.html). diff --git a/pyproject.toml b/pyproject.toml index 3039a511..8421819e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,13 +149,10 @@ line-ending = "auto" known-first-party = ["virtualizarr"] [tool.coverage.run] -omit = ["virtualizarr/tests/*"] +include = ["virtualizarr/"] +omit = ["conftest.py", "virtualizarr/tests/*"] [tool.pytest.ini_options] -addopts = [ - "--cov=virtualizarr", - "--cov-report=term-missing", -] # See https://pytest-asyncio.readthedocs.io/en/latest/concepts.html#asyncio-event-loops # Explicitly set asyncio_default_fixture_loop_scope to eliminate the following warning: #