Skip to content

Commit

Permalink
add pytest_crds as an entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Dec 12, 2024
1 parent cc174e4 commit 543f59b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ tracker = "https://github.com/spacetelescope/stpipe/issues"
[project.entry-points."asdf.resource_mappings"]
stpipe = "stpipe.integration:get_resource_mappings"

[project.entry-points.pytest11]
report_crds_context = "crds.pytest_crds.plugin"

[project.scripts]
stpipe = "stpipe.cli.main:main"
strun = "stpipe.cli.strun:main"
Expand Down
Empty file.
17 changes: 17 additions & 0 deletions src/stpipe/pytest_crds/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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"""

if config.getoption("report_crds_context"):
from stpipe.crds_client import get_context_used

return f"crds_context: {get_context_used('jwst')}"
else:
return []

0 comments on commit 543f59b

Please sign in to comment.