Skip to content

Commit

Permalink
Skip webbpsf tests by default (spacetelescope#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored and ddavis-stsci committed Nov 7, 2023
1 parent 1681335 commit 7469d83
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 22 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/roman_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ jobs:
cache-key: data-${{ needs.data.outputs.webbpsf_hash }}-${{ needs.data.outputs.crds_context }}
cache-restore-keys: webbpsf-${{ needs.data.outputs.webbpsf_hash }}
envs: |
- linux: py39-oldestdeps-cov
- linux: py39-oldestdeps-webbpsf-cov
pytest-results-summary: true
- linux: py39
- linux: py39-webbpsf
pytest-results-summary: true
- linux: py310
- linux: py310-webbpsf
pytest-results-summary: true
- linux: py311-ddtrace
- linux: py311-ddtrace-webbpsf
pytest-results-summary: true
- macos: py311-ddtrace
- macos: py311-ddtrace-webbpsf
pytest-results-summary: true
- linux: py311-cov
- linux: py311-webbpsf-cov
coverage: codecov
pytest-results-summary: true
8 changes: 4 additions & 4 deletions .github/workflows/roman_ci_cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
cache-key: data-${{ needs.data.outputs.webbpsf_hash }}-${{ needs.data.outputs.crds_context }}
cache-restore-keys: webbpsf-${{ needs.data.outputs.webbpsf_hash }}
envs: |
- macos: py39
- macos: py39-webbpsf
pytest-results-summary: true
- macos: py310
- macos: py310-webbpsf
pytest-results-summary: true
- macos: py311-sdpdeps
- macos: py311-sdpdeps-webbpsf
pytest-results-summary: true
- linux: py3-pyargs
- linux: py3-pyargs-webbpsf
pytest-results-summary: true
16 changes: 8 additions & 8 deletions .github/workflows/tests_devdeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ jobs:
cache-key: data-${{ needs.data.outputs.webbpsf_hash }}-${{ needs.data.outputs.crds_context }}
cache-restore-keys: webbpsf-${{ needs.data.outputs.webbpsf_hash }}
envs: |
- linux: py39-devdeps
- macos: py39-devdeps
- linux: py310-devdeps
- macos: py310-devdeps
- linux: py311-devdeps
- macos: py311-devdeps
- linux: py3-devdeps
- linux: py39-devdeps-webbpsf
- macos: py39-devdeps-webbpsf
- linux: py310-devdeps-webbpsf
- macos: py310-devdeps-webbpsf
- linux: py311-devdeps-webbpsf
- macos: py311-devdeps-webbpsf
- linux: py3-devdeps-webbpsf
pytest-results-summary: true
- macos: py3-devdeps
- macos: py3-devdeps-webbpsf
pytest-results-summary: true
2 changes: 1 addition & 1 deletion JenkinsfileRT
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bc0.build_cmds = bc0.build_cmds + [
"pip list"
]
bc0.test_cmds = [
"pytest -r sxf -n auto --bigdata --slow \
"pytest -r sxf -n auto --bigdata --slow --webbpsf \
--cov --cov-report=xml:coverage.xml \
--ddtrace \
--basetemp=${pytest_basetemp} --junit-xml=results.xml --dist=loadscope \
Expand Down
2 changes: 1 addition & 1 deletion JenkinsfileRT_dev
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bc0.build_cmds = bc0.build_cmds + [
"pip list"
]
bc0.test_cmds = [
"pytest -r sxf -n 0 --bigdata --slow \
"pytest -r sxf -n 0 --bigdata --slow --webbpsf \
--basetemp=${pytest_basetemp} --junit-xml=results.xml --dist=loadscope \
--env=${artifactoryenv} ${pytest_args}",
]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ $ crds sync --contexts roman-edit
The CRDS_READONLY_CACHE variable should not be set, since references will need to be downloaded to your local cache as
they are requested.

Additionally, currently WebbPSF data is also required. Follow [these instructions to download the data files / point to existing files on the shared internal network](https://webbpsf.readthedocs.io/en/latest/installation.html#data-install).
> **Note**\
> If it is desired to run tests against WebbPSF data, use the `pytest --webbpsf` flag or the `-webbpsf` tox factor and follow [these instructions to download the data files / point to existing files on the shared internal network](https://webbpsf.readthedocs.io/en/latest/installation.html#data-install).
### Running tests

Expand Down
23 changes: 23 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pytest


def pytest_configure(config):
config.addinivalue_line(
"markers", "webbpsf: mark test as requiring webbpsf data to run"
)


def pytest_addoption(parser):
parser.addoption(
"--webbpsf", action="store_true", default=False, help="run webbpsf tests"
)


def pytest_collection_modifyitems(config, items):
if config.getoption("--webbpsf"):
# --runslow given in cli: do not skip slow tests
return
skip_webbpsf = pytest.mark.skip(reason="need --webbpsf option to run")
for item in items:
if "webbpsf" in item.keywords:
item.add_marker(skip_webbpsf)
1 change: 1 addition & 0 deletions romancal/lib/tests/test_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def add_synthetic_sources(
synth_err[slc_lg] = np.sqrt(synth_err[slc_lg] ** 2 + model_err**2)


@pytest.mark.webbpsf
@pytest.mark.parametrize(
"dx, dy, true_amp",
zip(
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
env_list =
check-{style,dependencies,build}
test{,-alldeps,-devdeps}{,-pyargs,-warnings,-regtests,-cov}
test{,-alldeps,-devdeps}{,-pyargs,-warnings,-regtests,-cov,-webbpsf}
test-numpy{120,121,122}-xdist
build-{docs,dist}

Expand Down Expand Up @@ -46,6 +46,7 @@ description =
cov: with coverage
xdist: using parallel processing
ddtrace: passing test traces to DataDog agent
webbpsf: run the webbpsf tests
pass_env =
HOME
CI
Expand Down Expand Up @@ -77,6 +78,7 @@ commands =
xdist: -n 0 \
pyargs: {toxinidir}/docs --pyargs {posargs:romancal} \
ddtrace: --ddtrace \
webbpsf: --webbpsf \
{posargs}

[testenv:build-docs]
Expand Down

0 comments on commit 7469d83

Please sign in to comment.