diff --git a/src/murfey/client/analyser.py b/src/murfey/client/analyser.py index 0cd793abb..3fe96be9c 100644 --- a/src/murfey/client/analyser.py +++ b/src/murfey/client/analyser.py @@ -401,6 +401,7 @@ def _analyse(self, transferred_file: Path): "AtlasContext" | "CLEMContext" | "FIBContext" + | "SIMContext" | "SPAMetadataContext" | "SXTContext" | "TomographyMetadataContext" diff --git a/src/murfey/client/contexts/sim.py b/src/murfey/client/contexts/sim.py new file mode 100644 index 000000000..699b9451e --- /dev/null +++ b/src/murfey/client/contexts/sim.py @@ -0,0 +1,28 @@ +import logging +from pathlib import Path + +from murfey.client.context import Context +from murfey.client.instance_environment import MurfeyInstanceEnvironment + +logger = logging.getLogger("murfey.client.contexts.sim") + + +class SIMContext(Context): + def __init__( + self, + acquisition_software: str, + basepath: Path, + machine_config: dict, + token: str, + ): + super().__init__("SIMContext", acquisition_software, token) + self._basepath = basepath + self._machine_config = machine_config + + def post_transfer( + self, + transferred_file: Path, + environment: MurfeyInstanceEnvironment | None = None, + **kwargs, + ): + return None diff --git a/tests/client/contexts/test_sim.py b/tests/client/contexts/test_sim.py new file mode 100644 index 000000000..d0e8beb38 --- /dev/null +++ b/tests/client/contexts/test_sim.py @@ -0,0 +1,52 @@ +from pathlib import Path + +from murfey.client.contexts.sim import SIMContext + + +def test_sim_context_initialises(tmp_path: Path): + # Initialise the context with dummy variables + base_path = tmp_path + machine_config = {"dummy": "dummy"} + context = SIMContext( + "sim", + basepath=base_path, + machine_config=machine_config, + token="dummy", + ) + + assert context._basepath == base_path + assert context._machine_config == machine_config + assert context._token == "dummy" + assert context.name == "SIMContext" + + +def test_post_transfer( + tmp_path: Path, +): + """ + NOTE: This is just a basic test for coverage purposes, and will be rewritten + as the SIMContext logic evolves and matures. + """ + # Create a dummy file + base_path = tmp_path + visit_dir = base_path / "visit" + test_file = visit_dir / "raw" / "dummy.txt" + test_file.parent.mkdir(parents=True, exist_ok=True) + test_file.touch(exist_ok=True) + + # Create other mock variables + machine_config = {"dummy": "dummy"} + + context = SIMContext( + "sim", + basepath=base_path, + machine_config=machine_config, + token="dummy", + ) + assert ( + context.post_transfer( + transferred_file=test_file, + environment=None, + ) + is None + )