Skip to content

Commit

Permalink
MAINT: move coverage config to setup.cfg (#1481)
Browse files Browse the repository at this point in the history
* MAINT: move coverage config to setup.cfg

* TST: improve list of excludes from coverage

* Exclude defs and such from coverage

* Remove defs, clas and triple quotes from coverage excludes

* Remove decorators, add entry points to coverage skip

* Run coverage manually to improve reported coverage

* Check if failing tests still make CI fail

* Make failing tests fail CI again, remove pytest-pep8 and pytest-cov

* Remove test failure
  • Loading branch information
kohr-h committed Mar 13, 2019
1 parent 880534c commit 18b7178
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 66 deletions.
56 changes: 0 additions & 56 deletions .coveragerc

This file was deleted.

7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ install:
- conda create -n testenv python=$TRAVIS_PYTHON_VERSION nomkl
- source activate testenv
# Install packages with pip if possible, it's way faster
- pip install "numpy==$NUMPY_VERSION" scipy future packaging scikit-image pywavelets pytest pytest-cov;
- pip install "numpy==$NUMPY_VERSION" scipy future packaging scikit-image pywavelets;
# Building pyfftw wheels sometimes fails, using a conda-forge version instead;
# To avoid a lower version of NumPy being installed over the pip one, we exclude all dependencies
# (PyFFTW only depends on NumPy)
Expand All @@ -72,8 +72,9 @@ script:
# Also invoke the alternative way of running the unit tests.
# Fail immediately after first failure to speed up the whole thing.
- if [[ "$SKIP_TESTS" != "true" ]]; then
pytest --doctest-modules --cov --cov-report term-missing $TRAVIS_BUILD_DIR/odl || exit -1;
python -c "import odl; odl.test()" || exit -1;
pytest --doctest-modules $TRAVIS_BUILD_DIR/odl || exit -1;
echo "import odl; odl.test(['--doctest-modules'])" > $TRAVIS_BUILD_DIR/_run_tests.py;
coverage run $TRAVIS_BUILD_DIR/_run_tests.py;
fi
# Build the Sphinx doc (only for one specific build, master branch, no PR)
# To avoid clogging the logs, we redirect stderr to /dev/null
Expand Down
2 changes: 1 addition & 1 deletion odl/util/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def test(arguments=None):
this_dir = os.path.dirname(__file__)
odl_root = os.path.abspath(os.path.join(this_dir, os.pardir, os.pardir))

args = ['-x', '{root}/odl'.format(root=odl_root)]
args = ['{root}/odl'.format(root=odl_root)]

ignores = ['--ignore={}'.format(file) for file in collect_ignore]
args.extend(ignores)
Expand Down
52 changes: 46 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ url = https://github.com/odlgroup/odl
download_url = https://github.com/odlgroup/odl/archive/master.zip
platforms = any
keywords = research, development, mathematics, prototyping, imaging, tomography
# See https://pypi.org/classifiers/
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
Expand Down Expand Up @@ -44,8 +45,6 @@ install_requires =
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
tests_require =
pytest >=3.0.3
pytest-pep8
pytest-cov
coverage >=4.0
coveralls
include_package_data = True
Expand All @@ -61,14 +60,10 @@ tests = odl/test, odl/pytest.ini
[options.extras_require]
testing =
pytest >=3.0.3
pytest-pep8
pytest-cov
coverage >=4.0
coveralls
all =
pytest >=3.0.3
pytest-pep8
pytest-cov
coverage >=4.0
coveralls
matplotlib
Expand Down Expand Up @@ -111,3 +106,48 @@ max-line-length = 79
exclude =
.git
__pycache__

[coverage:run]
branch = False
include =
odl/*
omit =
*/__init__.py
odl/test/*
odl/diagnostics/*
odl/space/entry_points.py
odl/util/graphics.py
odl/util/npy_compat.py
odl/util/pytest_config.py
odl/util/testutils.py

# Omit until we add ASTRA to our CI pipelines
odl/tomo/operators/ray_trafo.py
odl/tomo/backends/*

[coverage:report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain if tests don't hit defensive assertion code:
assert False
raise AssertionError
raise NotImplementedError
return NotImplemented

# Skip imports and __all__
import *
__all__

# Don't complain if non-runnable code isn't run:
if 0:
if False:
if __name__ == '__main__':

ignore_errors = True

[coverage:html]
directory = htmlcov

0 comments on commit 18b7178

Please sign in to comment.