From 5e5db51a1ee42689069aac78de7cd0dff6102517 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Tue, 7 Aug 2018 01:00:49 -0400 Subject: [PATCH] CI template --- .coveragerc | 11 ----------- .travis.yml | 20 ++++++++++---------- setup.cfg | 27 +++++++++++++++------------ tests/test_all.py | 5 +++-- 4 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 5c50aef..0000000 --- a/.coveragerc +++ /dev/null @@ -1,11 +0,0 @@ -[run] -cover_pylib=False -omit = /home/travis/virtualenv/* - -[report] -exclude_lines = - pragma: no cover - def __repr__ - RuntimeError - NotImplementedError - diff --git a/.travis.yml b/.travis.yml index d51be83..9fc245d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,11 @@ git: quiet: true python: - - 3.6 - - 3.7 +- 3.6 +- 3.7 os: - - linux +- linux addons: apt: @@ -22,13 +22,13 @@ addons: install: pip install -e .[tests] script: - - pytest -sv - - flake8 - - mypy . --ignore-missing-imports +- pytest -rsv +- flake8 +- mypy . --ignore-missing-imports after_success: - - if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then - pytest --cov; - coveralls; - fi +- if [[ $TRAVIS_PYTHON_VERSION == 3.6* ]]; then + pytest --cov; + coveralls; + fi diff --git a/setup.cfg b/setup.cfg index 64894f1..19d6cca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,9 @@ [metadata] name = demof2py version = 0.5.0 -url = https://github.com/scivision/f2pyExamples -description = demo Python wrap of Fortran author = Michael Hirsch, Ph.D. +description = demo Python wrap of Fortran +url = https://github.com/scivision/f2pyExamples keywords = fortran f2py @@ -12,6 +12,7 @@ classifiers = Environment :: Console Intended Audience :: End Users/Desktop Operating System :: OS Independent + Programming Language :: Fortran Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 license_file = LICENSE @@ -20,16 +21,17 @@ long_description_content_type = text/markdown [options] python_requires = >= 2.7 -setup_requires = +setup_requires = setuptools >= 38.6 pip >= 10 twine >= 1.11 include_package_data = True packages = find: install_requires = + numpy [options.extras_require] -tests = +tests = pytest pytest-cov coveralls @@ -49,17 +51,18 @@ omit = /home/travis/virtualenv/* */site-packages/* */bin/* + */build/* [coverage:report] exclude_lines = pragma: no cover def __repr__ - RuntimeError - NotImplementedError - ImportError - KeyError - FileNotFoundError - CalledProcessError + except RuntimeError + except NotImplementedError + except ImportError + except FileNotFoundError + except CalledProcessError logging.warning - ValueError - TypeError + logging.error + logging.critical + if __name__ == .__main__.: diff --git a/tests/test_all.py b/tests/test_all.py index 5bb88ab..7010d2a 100755 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -2,6 +2,7 @@ import numpy as np from pyprod import prod import pytest +from pytest import approx def test_main(): @@ -16,7 +17,7 @@ def test_main(): znointent = prod.prodnointent(x, y, znoint) assert znointent is None # unmodified due to f2py intent(in) by default - assert np.isclose(znoint, 12345.) + assert znoint == approx(12345.) # %% zpure = prod.prodpure(x, y) assert zpure == x*y @@ -28,4 +29,4 @@ def test_main(): if __name__ == '__main__': - pytest.main() + pytest.main(['-x', __file__])