DMSC Integration Testing

Last updated: December 17, 2025 22:42:25

Test: ingestor|nmx|file_found_is_not_old|manual

None

None

None

None

None

None

None

None

None

None

None

None

instrument = 'nmx', coda_proposal_id = '999999'
datefinder =

def test_file_found_is_not_old(
instrument: str,
coda_proposal_id: str,
datefinder: Callable[..., datetime],
) -> None:
> date = datefinder(instrument=instrument, proposal_id=coda_proposal_id)

tests/ingestor/ingestor_test.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/ingestor/lib/python3.12/site-packages/dmsc_nightly/nexusfiles/coda.py:105: in get_latest_nexus_time
path = get_latest_nexus_paths(instrument=instrument, proposal_id=proposal_id)[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

instrument = 'nmx', proposal_id = '999999', n = 1

@cache
def get_latest_nexus_paths(
instrument: str, proposal_id: str | None, n: int = 1
) -> list[Path]:
"""
Get the latest file paths manually by sorting the files in the directory.

Parameters
----------
instrument:
The instrument name.
proposal_id:
SciCat proposal ID for CODA.
If ``None``, the environment variable ``OVERRIDE_RAW_DATA_DIR`` must be set.
n:
Return up to n files.

Returns
-------
:
Paths to the n latest files for the given instrument and proposal.
"""
base_path = _coda_raw_data_path(proposal_id)
glob = _RAW_FILE_GLOB_PATTERN.format(instrument=instrument)
logging.info(
"Searching for files for instrument %s in %s with glob %s",
instrument,
base_path,
glob,
)

# Note that this gets the ctime of _all_ files matching the glob.
recent_files = sorted(base_path.glob(glob), key=get_ctime)[::-1]
if not recent_files:
logging.error("No files found for instrument %s", instrument)
raise RuntimeError(f"No files found for instrument {instrument}")

openable_files = _first_n_openable_files(recent_files, n)
if not openable_files:
logging.error("No files found for instrument %s that can be opened", instrument)
> raise RuntimeError(
f"No files found for instrument {instrument} that can be opened"
)
E RuntimeError: No files found for instrument nmx that can be opened

.tox/ingestor/lib/python3.12/site-packages/dmsc_nightly/nexusfiles/coda.py:73: RuntimeError

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None

None