Skip to content

Commit

Permalink
Use imap_data_access.config DATA_DIR instead of new tmp_path to write…
Browse files Browse the repository at this point in the history
… test metakernel

Move leapsecond and spacecraft clock kernel into imap_processing package
  • Loading branch information
subagonsouth committed Aug 12, 2024
1 parent 8ff1136 commit 5c14546
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
13 changes: 6 additions & 7 deletions imap_processing/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _autoclear_spice():

@pytest.fixture(scope="session")
def spice_test_data_path(imap_tests_path):
return imap_module_directory.parent / "tools/tests/test_data/spice"
return imap_tests_path / "spice/test_data"


@pytest.fixture()
Expand All @@ -59,7 +59,7 @@ def furnish_sclk(spice_test_data_path):


@pytest.fixture()
def use_test_metakernel(tmpdir_factory, monkeypatch, spice_test_data_path):
def use_test_metakernel(monkeypatch, spice_test_data_path):
"""For the whole test session, set the SPICE_METAKERNEL environment variable
Prime the test metakernel by creating it from the template metakernel
(allows using absolute paths on any dev system)"""
Expand Down Expand Up @@ -119,10 +119,9 @@ def get_test_kernels_to_load():
kernel = kernel[stop_idx:]
return kernels_to_load

metakernel_path = tmpdir_factory.mktemp("spice")
metakernel = metakernel_path.join("imap_2024_v001.tm")
metakernel_path = imap_data_access.config["DATA_DIR"] / "imap_2024_v001.tm"
kernels_to_load = get_test_kernels_to_load()
make_metakernel_from_kernels(metakernel, kernels_to_load)
monkeypatch.setenv("SPICE_METAKERNEL", str(metakernel))
yield str(metakernel)
make_metakernel_from_kernels(metakernel_path, kernels_to_load)
monkeypatch.setenv("SPICE_METAKERNEL", str(metakernel_path))
yield str(metakernel_path)
spice.kclear()
File renamed without changes.
7 changes: 7 additions & 0 deletions tools/tests/unit/test_spice_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
import spiceypy as spice

from imap_processing import imap_module_directory
from tools.spice.spice_examples import (
_get_particle_velocity,
build_annotated_events,
Expand All @@ -29,6 +30,12 @@ def kernels(kernel_directory):
kernels = list_files_with_extensions(
kernel_directory, [".tsc", ".tls", ".tf", ".bsp", ".ck"]
)
# Some kernels were moved into imap_processing package
kernels.extend(
list_files_with_extensions(
imap_module_directory / "tests/spice/test_data", [".tsc", ".tls"]
)
)
return kernels


Expand Down

0 comments on commit 5c14546

Please sign in to comment.