Skip to content

Commit

Permalink
add pytest no-crds option to disable tests that require crds
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored and zacharyburnett committed Mar 13, 2023
1 parent 8167f3c commit 0d7670e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![codecov](https://codecov.io/gh/spacetelescope/stdatamodels/branch/master/graph/badge.svg?token=TrmUKaTP2t)](https://codecov.io/gh/spacetelescope/stdatamodels)


Provides `DataModel`, which is the base class for data models implemented in the JWST calibration software.
Provides `DataModel`, which is the base class for data models implemented in the JWST and Roman calibration software.


## Unit Tests
Expand All @@ -18,3 +18,9 @@ for more information). Minimally (if not on the stsci vpn where the default path
```bash
export CRDS_PATH=/tmp/crds_cache/jwst_ops
```

These tests can also be skipped with the `no-crds` pytest option

```bash
pytest --no-crds
```
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def flatten(xs):
}


@pytest.mark.skipif(
"config.getoption('--no-crds')",
reason="no_crds option was enabled",
)
@pytest.mark.parametrize('instrument', ['fgs', 'miri', 'nircam', 'niriss', 'nirspec'])
def test_crds_selectors_vs_datamodel(jail_environ, instrument):
log.info(f"crds_path: {crds.config.get_crds_path()}")
Expand Down
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
from stdatamodels import s3_utils


def pytest_addoption(parser):
parser.addoption(
"--no-crds",
action="store_true",
default=False,
help="Skip tests against crds",
)


@pytest.fixture(autouse=True)
def monkey_patch_s3_client(monkeypatch, request):
# If tmpdir is used in the test, then it is providing the file. Map to it.
Expand Down

0 comments on commit 0d7670e

Please sign in to comment.