Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/murfey/client/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def _analyse(self, transferred_file: Path):
"AtlasContext"
| "CLEMContext"
| "FIBContext"
| "SIMContext"
| "SPAMetadataContext"
| "SXTContext"
| "TomographyMetadataContext"
Expand Down
28 changes: 28 additions & 0 deletions src/murfey/client/contexts/sim.py
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions tests/client/contexts/test_sim.py
Original file line number Diff line number Diff line change
@@ -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
)
Loading