From dd8c748ed5460282f13f0816901cf6928abc798f Mon Sep 17 00:00:00 2001 From: Robert Rosca <robert.rosca@xfel.eu> Date: Thu, 8 Apr 2021 17:59:41 +0200 Subject: [PATCH] Add paths attribute for CalibrateCall --- tests/test_xfel_calibrate/conftest.py | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/test_xfel_calibrate/conftest.py b/tests/test_xfel_calibrate/conftest.py index 50a7f7f53..36bae7c41 100644 --- a/tests/test_xfel_calibrate/conftest.py +++ b/tests/test_xfel_calibrate/conftest.py @@ -1,6 +1,7 @@ +# pylint: disable=missing-module-docstring import sys from pathlib import Path -from typing import Callable, Dict, List, Optional, Union +from typing import Callable, Dict, List, NamedTuple, Optional, Union from unittest import mock import extra_data.tests.make_examples as make_examples @@ -8,9 +9,11 @@ import pytest from xfel_calibrate import calibrate, settings +from pytest_subprocess.core import FakeProcess + @pytest.fixture(autouse=True) -def fake_process_xfel_calibrate(fake_process): +def fake_process_xfel_calibrate(fake_process: FakeProcess) -> FakeProcess: """Sets up fake process for use with xfel calibrate Fakes: @@ -85,7 +88,9 @@ class MockProposal: self.instrument = instrument self.cycle = cycle self.proposal = proposal - self.sequences = list(range(sequences)) # TODO: Implement once it's in extra-data + self.sequences = list( + range(sequences) + ) # TODO: Implement once it's in extra-data self.path = tmp_path / instrument / cycle / proposal self.path_raw = self.path / "raw" @@ -212,3 +217,20 @@ class CalibrateCall: self.out: str = out self.err: str = err + + Paths = NamedTuple( + "Paths", + [ + ("notebooks", List[Path]), + ("run_calibrate", Path), + ("finalize", Path), + ("InputParameters", Path), + ], + ) + + self.paths = Paths( + notebooks=list(self.tmp_path.glob("**/*/*.ipynb")), + run_calibrate=list(self.tmp_path.glob("**/*/run_calibrate.sh"))[0], + finalize=list(self.tmp_path.glob("**/*/finalize.py"))[0], + InputParameters=list(self.tmp_path.glob("**/*/InputParameters.rst"))[0], + ) -- GitLab