diff --git a/.github/workflows/roman_ci.yml b/.github/workflows/roman_ci.yml index 9355430f6..2fd7cf87c 100644 --- a/.github/workflows/roman_ci.yml +++ b/.github/workflows/roman_ci.yml @@ -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 diff --git a/.github/workflows/roman_ci_cron.yaml b/.github/workflows/roman_ci_cron.yaml index cb74f9217..c404f9567 100644 --- a/.github/workflows/roman_ci_cron.yaml +++ b/.github/workflows/roman_ci_cron.yaml @@ -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 diff --git a/.github/workflows/tests_devdeps.yml b/.github/workflows/tests_devdeps.yml index 485dd1012..997280f16 100644 --- a/.github/workflows/tests_devdeps.yml +++ b/.github/workflows/tests_devdeps.yml @@ -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 diff --git a/JenkinsfileRT b/JenkinsfileRT index 33edc010c..8636d3561 100644 --- a/JenkinsfileRT +++ b/JenkinsfileRT @@ -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 \ diff --git a/JenkinsfileRT_dev b/JenkinsfileRT_dev index 60688491f..886b62510 100644 --- a/JenkinsfileRT_dev +++ b/JenkinsfileRT_dev @@ -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}", ] diff --git a/README.md b/README.md index a10982257..9a4843c61 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/conftest.py b/conftest.py new file mode 100644 index 000000000..4f0696448 --- /dev/null +++ b/conftest.py @@ -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) diff --git a/romancal/lib/tests/test_psf.py b/romancal/lib/tests/test_psf.py index 29a412360..9fb9108eb 100644 --- a/romancal/lib/tests/test_psf.py +++ b/romancal/lib/tests/test_psf.py @@ -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( diff --git a/tox.ini b/tox.ini index 1d7ac3f62..9766e5c94 100644 --- a/tox.ini +++ b/tox.ini @@ -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} @@ -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 @@ -77,6 +78,7 @@ commands = xdist: -n 0 \ pyargs: {toxinidir}/docs --pyargs {posargs:romancal} \ ddtrace: --ddtrace \ + webbpsf: --webbpsf \ {posargs} [testenv:build-docs]