Skip to content

Commit

Permalink
Add --report-crds-context pytest option (spacetelescope#6070)
Browse files Browse the repository at this point in the history
  • Loading branch information
eslavich authored May 25, 2021
1 parent fda15ac commit 20d5bbb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
1.2.1 (unreleased)
==================

general
-------



- Make CRDS context reporting pytest plugin disabled by default. [#6070]

1.2.0 (2021-05-24)
==================
Expand Down
11 changes: 9 additions & 2 deletions pytest_crds/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from stpipe.crds_client import get_context_used
def pytest_addoption(parser):
parser.addoption("--report-crds-context", action="store_true",
help="Report CRDS context in test suite header")


def pytest_report_header(config):
"""Add CRDS_CONTEXT to pytest report header"""
return f"crds_context: {get_context_used('jwst')}"

if config.getoption("report_crds_context"):
from stpipe.crds_client import get_context_used
return f"crds_context: {get_context_used('jwst')}"
else:
return []
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ junit_family = xunit2
inputs_root = jwst-pipeline
results_root = jwst-pipeline-results
text_file_format = rst
addopts = --show-capture=no --open-files
addopts = --show-capture=no --open-files --report-crds-context
filterwarnings =
ignore:Models in math_functions:astropy.utils.exceptions.AstropyUserWarning

Expand Down

0 comments on commit 20d5bbb

Please sign in to comment.