diff --git a/imap_processing/tests/conftest.py b/imap_processing/tests/conftest.py index c1decb21f..b9adc63e3 100644 --- a/imap_processing/tests/conftest.py +++ b/imap_processing/tests/conftest.py @@ -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() @@ -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)""" @@ -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() diff --git a/tools/tests/test_data/spice/imap_sclk_0000.tsc b/imap_processing/tests/spice/test_data/imap_sclk_0000.tsc similarity index 100% rename from tools/tests/test_data/spice/imap_sclk_0000.tsc rename to imap_processing/tests/spice/test_data/imap_sclk_0000.tsc diff --git a/tools/tests/test_data/spice/imap_test_metakernel.template b/imap_processing/tests/spice/test_data/imap_test_metakernel.template similarity index 100% rename from tools/tests/test_data/spice/imap_test_metakernel.template rename to imap_processing/tests/spice/test_data/imap_test_metakernel.template diff --git a/tools/tests/test_data/spice/naif0012.tls b/imap_processing/tests/spice/test_data/naif0012.tls similarity index 100% rename from tools/tests/test_data/spice/naif0012.tls rename to imap_processing/tests/spice/test_data/naif0012.tls diff --git a/tools/tests/unit/test_spice_examples.py b/tools/tests/unit/test_spice_examples.py index d998a3008..d47a607cd 100644 --- a/tools/tests/unit/test_spice_examples.py +++ b/tools/tests/unit/test_spice_examples.py @@ -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, @@ -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