Skip to content

Running regression tests locally

P. L. Lim edited this page Sep 3, 2025 · 15 revisions

Build calxxx and install test dependencies as instructed in INSTALL.md. Additionally, you can also install pytest-xdist (-n) for distributing tests across CPUs, but note that even without this, the CTE correction for ACS and WFC3 would use up all the cores anyway.

Set up environment variables and CRDS as instructed in README.md. Example:

export jref="/grp/crds/cache/references/hst/"
export iref="/grp/crds/cache/references/hst/"
export oref="/grp/crds/cache/references/hst/"
export CRDS_PATH="/path/to/local/crds_cache"
export CRDS_SERVER_URL="https://hst-crds.stsci.edu"

Download and configure jfrog as laid out in Maintaining Regression Tests in JWST.

To set up local checkout of "big data" to $HOME (though it is preferable to store them to a disk that is physically close to the CPU, e.g., /internal/1):

$ mkdir ~/test_bigdata
$ mkdir ~/test_bigdata/scsb-hstcal
$ cd ~/test_bigdata/scsb-hstcal
$ jfrog rt dl "scsb-hstcal/dev/*" ./
$ export TEST_BIGDATA=$HOME/test_bigdata/

The scsb-hstcal directory layout is as follows:

scsb-hstcal
  environment  (dev or n.n.n)
    instrument (acs | wfc3 | stis)
      detector (acs: hrc | sbc | wfc, wfc3: ir | uvis)
        input
        truth

To run all the tests from hstcal source checkout root directory:

$ pytest tests/ [-n 8] -s -v[v] --bigdata --slow [--run-slow] --basetemp=/path/to/pytest_output/ &> test_output.log
  • -n 8: Use 8 CPUs. Find out how many you have first using nproc before you set the number, preferably at most 1 less than max.
  • -s: Shows screen output.
  • -v: More verbose. Add another v for even more.
  • --bigdata: Run tests that need TEST_BIGDATA defined to know where to locate the input FITS files.
  • --slow: Run tests marked as slow.
  • --run-slow: Need this for --slow to work if you have pytest-astropy installed; see https://github.com/spacetelescope/ci_watson/issues/83
  • --basetemp: Write test output files into the given directory instead of /tmp. Files are loaded into this area and processed in subdirectories based on test names. Be careful as this area is destroyed for each new pytest run.
  • &> test_output.log: Capture stdout and stderr into the given log file. Monitor with tail -f test_output.log, if desired. The & tells it to run in the background.

New reference file

If you are adding a totally new reference file type to the test suite, you have to remember to add it to the tests/helpers.py file. Otherwise, the tests will claim they cannot open/read the new file.

New truth file

Okify currently does not work. Manually copy them over to Artifactory.

Re-sync local TEST_BIGDATA

This is useful to do when truths have changed in Artifactory and you want to run the tests locally as well.

$ cd ~/test_bigdata/scsb-hstcal
$ jfrog rt dl "scsb-hstcal/dev/*" ./ --sync-deletes dev

Testing different C executables

If you use Conda/Mamba and installed calxxx within the environment, the executables will be in something like this:

/path/to/miniconda3/envs/CALDP-2025.2.1-4+photutils/bin

The tests in Python are not installed with the executables. By default, they look for calxxx according to your PATH, which includes the Conda/Mamba bin directory already. Alternately, you can have the tests look for calxxx in non-default places (BE CAREFUL), such as:

  • hardcoding the full path name to calxxx in the test being executed;
  • specifying custom install destination in your cmake call (see INSTALL.md) and then prepending that location to your existing PATH environment variable (export PATH="MyNewPath:$PATH"); or
  • copying the executable(s) you created in your original install directory to the bin directory of your Conda/Mamba environment.

Clone this wiki locally