Skip to content

Commit

Permalink
Merge pull request #1517 from dopplershift/fix-coverage
Browse files Browse the repository at this point in the history
Fix test coverage reporting
  • Loading branch information
dcamron committed Sep 30, 2020
2 parents bf77d24 + a716f7f commit 6b966f8
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
4 changes: 0 additions & 4 deletions .codecov.yml
@@ -1,7 +1,3 @@
codecov:
notify:
require_ci_to_pass: no

coverage:
status:
patch:
Expand Down
10 changes: 10 additions & 0 deletions .coveragerc
@@ -0,0 +1,10 @@
[paths]
source =
src/
/*/site-packages

[run]
source = tests
source_pkgs = metpy
omit =
src/metpy/io/_nexrad_msgs/parse_spec.py
8 changes: 7 additions & 1 deletion .github/workflows/tests-conda.yml
Expand Up @@ -85,9 +85,13 @@ jobs:
python -m pip install --no-deps .
- name: Run tests
# By running coverage in "parallel" mode and "combining", we can clean up the path names
run: |
export TEST_DATA_DIR=$GITHUB_WORKSPACE/staticdata
python -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning --cov=metpy --cov=tests --cov-report=xml
python -m coverage run -p -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning tests/
python -m coverage combine
python -m coverage report
python -m coverage xml
- name: Run doctests
# Windows produces some slightly different types that causes doctests to fail
Expand All @@ -105,3 +109,5 @@ jobs:

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: conda-${{ matrix.python-version }}-${{ runner.os }}
7 changes: 6 additions & 1 deletion .github/workflows/tests-pypi.yml
Expand Up @@ -107,7 +107,10 @@ jobs:
run: |
export TEST_DATA_DIR=$GITHUB_WORKSPACE/staticdata
export NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1
python -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning --cov=metpy --cov=tests --cov-report=xml
python -m coverage run -p -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning tests/
python -m coverage combine
python -m coverage report
python -m coverage xml
- name: Run doctests
if: ${{ matrix.dep-versions == 'Current.txt' && matrix.no-extras != 'No Extras' }}
Expand All @@ -124,3 +127,5 @@ jobs:

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: pypi-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ matrix.no-extras }}-${{ runner.os }}
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -81,7 +81,10 @@ script:
false;
fi;
else
python -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning --cov=metpy --cov=tests;
python -m coverage run -p -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning tests/;
python -m coverage combine;
python -m coverage report;
python -m coverage xml;
fi

after_script:
Expand Down
2 changes: 1 addition & 1 deletion ci/test_requirements.txt
@@ -1,4 +1,4 @@
pytest==6.1.0
pytest-cov==2.10.1
pytest-mpl==0.11
netCDF4==1.5.4
coverage==5.3
3 changes: 0 additions & 3 deletions setup.cfg
Expand Up @@ -96,9 +96,6 @@ norecursedirs = build docs .idea
doctest_optionflags = NORMALIZE_WHITESPACE
mpl-results-path = test_output

[coverage:run]
omit = src/metpy/io/_nexrad_msgs/parse_spec.py,src/metpy/io/metar_parser.py

[doc8]
ignore-path = docs/build,docs/api/generated,docs/_templates,docs/tutorials,docs/examples
file-encoding = utf8
Expand Down
13 changes: 1 addition & 12 deletions src/metpy/io/gini.py
Expand Up @@ -14,10 +14,7 @@
import numpy as np
from xarray import Variable
from xarray.backends.common import AbstractDataStore
try:
from xarray.core.utils import FrozenDict
except ImportError:
from xarray.core.utils import FrozenOrderedDict as FrozenDict
from xarray.core.utils import FrozenDict

from ._tools import Bits, IOBuffer, NamedStruct, open_as_needed, zlib_decompress_all_frames
from ..package_tools import Exporter
Expand Down Expand Up @@ -405,11 +402,3 @@ def get_attrs(self):
"""
return FrozenDict(satellite=self.prod_desc.creating_entity,
sector=self.prod_desc.sector_id)

def get_dimensions(self):
"""Get the file's dimensions.
This is used by `xarray.open_dataset`.
"""
return FrozenDict(x=self.prod_desc.nx, y=self.prod_desc.ny)

0 comments on commit 6b966f8

Please sign in to comment.