Skip to content

Commit 543f59b

Browse files
add pytest_crds as an entrypoint
1 parent cc174e4 commit 543f59b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ tracker = "https://github.com/spacetelescope/stpipe/issues"
4646
[project.entry-points."asdf.resource_mappings"]
4747
stpipe = "stpipe.integration:get_resource_mappings"
4848

49+
[project.entry-points.pytest11]
50+
report_crds_context = "crds.pytest_crds.plugin"
51+
4952
[project.scripts]
5053
stpipe = "stpipe.cli.main:main"
5154
strun = "stpipe.cli.strun:main"

src/stpipe/pytest_crds/__init__.py

Whitespace-only changes.

src/stpipe/pytest_crds/plugin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def pytest_addoption(parser):
2+
parser.addoption(
3+
"--report-crds-context",
4+
action="store_true",
5+
help="Report CRDS context in test suite header",
6+
)
7+
8+
9+
def pytest_report_header(config):
10+
"""Add CRDS_CONTEXT to pytest report header"""
11+
12+
if config.getoption("report_crds_context"):
13+
from stpipe.crds_client import get_context_used
14+
15+
return f"crds_context: {get_context_used('jwst')}"
16+
else:
17+
return []

0 commit comments

Comments
 (0)