Skip to content

Commit

Permalink
add markers for hst, jwst, revert back to original test config
Browse files Browse the repository at this point in the history
  • Loading branch information
alphasentaurii committed Apr 17, 2024
1 parent ea320e0 commit 8d7521a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 13 additions & 15 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def __init__(self, cache=None, url=None, clear_existing=True, observatory=None,
def config_setup(self):
"""Reset the CRDS configuration state to support testing given the supplied parameters."""
log.set_test_mode()
if self.clear_existing:
self.reset_defaults()
self.old_state = crds_config.get_crds_state()
self.old_state["CRDS_CWD"] = os.getcwd()
if self.clear_existing:
crds_config.clear_crds_state()
self.new_state = dict(self.old_state)
self.new_state["CRDS_CWD"] = HERE
if self.url is not None:
Expand All @@ -180,9 +180,7 @@ def cleanup(self):
def reset_defaults(self):
"""Generic CRDS environment variables consistent across observatories.
Any kwargs passed into a ConfigState object will override these default values.
Most configuration fixtures use the default `clear_existing=True` kwarg, which invokes
this function to initialize default values into the 'old_state' attribute. When cleanup
is run, this 'old_state' is re-instantiated as the configuration."""
This reset is 'softer' than the crds built-in crds.config.clear_crds_state()."""
self.default_config = dict(
CRDS_PATH=os.environ.get("CRDS_PATH", "tmp/crds-cache-default-test"),
CRDS_CONTEXT=os.environ.get("CRDS_CONTEXT"),
Expand Down Expand Up @@ -210,8 +208,8 @@ def default_shared_state(crds_shared_group_cache):


@fixture(scope='function')
def hst_shared_cache_state(default_cache):
cfg = ConfigState(cache=default_cache, url="https://hst-crds.stsci.edu", observatory="hst")
def hst_shared_cache_state(crds_shared_group_cache):
cfg = ConfigState(cache=crds_shared_group_cache, url="https://hst-crds.stsci.edu", observatory="hst")
cfg.config_setup()
yield cfg
cfg.cleanup()
Expand Down Expand Up @@ -242,9 +240,9 @@ def jwst_no_cache_state():


@fixture(scope='function')
def jwst_shared_cache_state(default_cache):
def jwst_shared_cache_state(crds_shared_group_cache):
cfg = ConfigState(
cache=default_cache,
cache=crds_shared_group_cache,
url="https://jwst-crds.stsci.edu",
observatory="jwst")
cfg.config_setup()
Expand All @@ -253,9 +251,9 @@ def jwst_shared_cache_state(default_cache):


@fixture(scope='function')
def jwst_serverless_state(default_cache):
def jwst_serverless_state(crds_shared_group_cache):
cfg = ConfigState(
cache=default_cache,
cache=crds_shared_group_cache,
url="https://jwst-crds-serverless.stsci.edu",
observatory="jwst"
)
Expand All @@ -265,9 +263,9 @@ def jwst_serverless_state(default_cache):


@fixture(scope='function')
def hst_serverless_state(default_cache):
def hst_serverless_state(crds_shared_group_cache):
cfg = ConfigState(
cache=default_cache,
cache=crds_shared_group_cache,
url="https://hst-serverless-mode.stsci.edu",
observatory="hst"
)
Expand All @@ -289,9 +287,9 @@ def hst_persistent_state(test_cache):


@fixture(scope='function')
def roman_serverless_state(default_cache):
def roman_serverless_state(crds_shared_group_cache):
cfg = ConfigState(
cache=default_cache,
cache=crds_shared_group_cache,
url="https://roman-crds-serverless.stsci.edu",
observatory="roman"
)
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ markers = [
"diff",
"factory",
"heavy_client",
"hst",
"io",
"jwst",
"list",
"locking",
"matches",
Expand Down

0 comments on commit 8d7521a

Please sign in to comment.