Skip to content

Commit

Permalink
Merge pull request #28 from nabobalis/master
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Sep 30, 2020
2 parents 2468288 + a696060 commit b5a655f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
envs:
- macos: py38
name: py38_test
posargs: -n=1

- windows: py37
name: py37_test

- linux: py38-online
name: py38_test_online
posargs: -n=1

- linux: codestyle
name: python_codestyle
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ testpaths = "sunkit_instruments" "docs"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".jupyter" ".history" "tools"
doctest_plus = enabled
doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS
addopts = --doctest-rst --doctest-ignore-import-errors
addopts = -rsa -vvv --doctest-rst --doctest-ignore-import-errors
markers =
remote_data: marks this test function as needing remote data.
online: marks this test function as needing online connectivity.
Expand Down
15 changes: 12 additions & 3 deletions sunkit_instruments/fermi/tests/test_fermi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ def test_download_weekly_pointing_file():


@pytest.mark.remote_data
def test_detector_angles():
@pytest.fixture
def pointing_file():
# set a test date
date = parse_time('2012-02-15')
file = fermi.download_weekly_pointing_file(date)
det = fermi.get_detector_sun_angles_for_date(date, file)
return date, file


@pytest.mark.remote_data
def test_detector_angles(pointing_file):
det = fermi.get_detector_sun_angles_for_date(pointing_file[0], pointing_file[1])
assert len(det) == 13
assert_almost_equal(det['n0'][0].value, 21.79, decimal=1)
assert_almost_equal(det['n1'][0].value, 30.45, decimal=1)
Expand All @@ -36,8 +42,11 @@ def test_detector_angles():
assert_almost_equal(det['n10'][0].value, 106.95, decimal=1)
assert_almost_equal(det['n11'][0].value, 121.32, decimal=1)


@pytest.mark.remote_data
def test_detector_angles_2(pointing_file):
det2 = fermi.get_detector_sun_angles_for_time(
parse_time('2012-02-15 02:00'), file)
parse_time('2012-02-15 02:00'), pointing_file[1])
assert len(det2) == 13
assert type(det2) == dict
assert_almost_equal(det2['n0'].value, 83.54, decimal=1)
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ description =
setenv =
MPLBACKEND = agg
COLUMNS = 180
PYTEST_COMMAND = pytest -vvv -ra --pyargs sunkit_instruments --cov-report= --cov=sunkit_instruments --cov-config={toxinidir}/setup.cfg {toxinidir}/docs
PYTEST_COMMAND = pytest -vvv -ra --durations=25 --pyargs sunkit_instruments --cov-report= --cov=sunkit_instruments --cov-config={toxinidir}/setup.cfg {toxinidir}/docs
devdeps,build_docs,online: HOME = {envtmpdir}
SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/{envname}/sample_data/}
passenv =
Expand Down Expand Up @@ -58,7 +58,7 @@ extras =
dev
commands =
!online: {env:PYTEST_COMMAND} {posargs}
online: {env:PYTEST_COMMAND} --reruns 2 --timeout=180 --remote-data=any -m "remote_data" {posargs}
online: {env:PYTEST_COMMAND} --reruns 2 --timeout=60 --remote-data=any -m "remote_data" {posargs}

[testenv:build_docs]
usedevelop = true
Expand Down

0 comments on commit b5a655f

Please sign in to comment.