Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
ci template
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 15, 2018
1 parent 47cbaf6 commit e64f2bf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
22 changes: 11 additions & 11 deletions .travis.yml
Expand Up @@ -8,27 +8,27 @@ git:
quiet: true

python:
- 3.6
- 3.7
- 3.6
- 3.7

os:
- linux
- linux

addons:
apt:
packages:
- gfortran
- gfortran

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 --cov-config=setup.cfg;
coveralls;
fi

20 changes: 10 additions & 10 deletions setup.cfg
Expand Up @@ -21,7 +21,7 @@ long_description_content_type = text/markdown

[options]
python_requires = >= 3.6
setup_requires =
setup_requires =
setuptools >= 38.6
pip >= 10
twine >= 1.11
Expand All @@ -36,7 +36,7 @@ install_requires =
gridaurora

[options.extras_require]
tests =
tests =
pytest
pytest-cov
coveralls
Expand Down Expand Up @@ -64,12 +64,12 @@ omit =
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__.:
11 changes: 5 additions & 6 deletions tests/test_all.py
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
import xarray
from numpy import datetime64
from numpy.testing import assert_allclose
from pytest import approx
import pytest
import reesaurora as ra

Expand All @@ -22,16 +22,15 @@ def test_reesiono():
Q = ra.reesiono(t, z, E, glat, glon, isotropic, datfn=R / 'data/SergienkoIvanov.h5', verbose=False)
assert isinstance(Q, xarray.DataArray)
# %%
assert_allclose(Q.alt_km.values, z)
assert_allclose(Q.energy.values, E)
assert Q.alt_km.values == approx(z)
assert Q.energy.values == approx(E)
assert Q.time[0] == datetime64(t), 'times didnt match up'

Qv = Q.squeeze()
# Qv = Q[0].sum('species') # total production
# print([Qv[23,58],Qv[53,68]])
assert_allclose([Qv[23, 58], Qv[53, 68]],
[8.186955e-04, 5.609914e-06], rtol=1e-5)
assert [Qv[23, 58], Qv[53, 68]] == approx([8.186955e-04, 5.609914e-06], rel=1e-5)


if __name__ == '__main__':
pytest.main()
pytest.main(['-x', __file__])

0 comments on commit e64f2bf

Please sign in to comment.