Tweak types and fix mock persistence between tests
This commit is contained in:
parent
2c215b9f81
commit
cdab10ae46
2 changed files with 9 additions and 3 deletions
|
|
@ -112,8 +112,13 @@ class RelativeDataPath(RootModel[str]):
|
||||||
"""Return True if the saving thing is set."""
|
"""Return True if the saving thing is set."""
|
||||||
return self._saving_thing is not None
|
return self._saving_thing is not None
|
||||||
|
|
||||||
def set_saving_thing(self, thing: OFMThing) -> None:
|
def set_saving_thing(self, thing: OFMThing | TemporaryDirectory) -> None:
|
||||||
"""Set the Thing that is saving the data. This will set the data directory."""
|
"""Set the Thing that is saving the data.
|
||||||
|
|
||||||
|
The thing can also be a ``TemporaryDirectory`` object.
|
||||||
|
|
||||||
|
This will set the data directory.
|
||||||
|
"""
|
||||||
if self.save_location_set:
|
if self.save_location_set:
|
||||||
raise RuntimeError("The saving Thing for the relative path is already set")
|
raise RuntimeError("The saving Thing for the relative path is already set")
|
||||||
self._saving_thing = thing
|
self._saving_thing = thing
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,8 @@ def test_save_from_memory(test_case, test_env, mocker):
|
||||||
camera._add_metadata_to_capture = mocker.Mock()
|
camera._add_metadata_to_capture = mocker.Mock()
|
||||||
|
|
||||||
mode = CaptureMode(description="foo", save_resolution=test_case.save_resolution)
|
mode = CaptureMode(description="foo", save_resolution=test_case.save_resolution)
|
||||||
type(camera).capture_modes = mocker.PropertyMock(return_value={"standard": mode})
|
capture_modes_mock = mocker.PropertyMock(return_value={"standard": mode})
|
||||||
|
mocker.patch.object(type(camera), "capture_modes", capture_modes_mock)
|
||||||
|
|
||||||
mock_image = mocker.Mock()
|
mock_image = mocker.Mock()
|
||||||
# Make resize return itself so we can track further calls of the Image object after
|
# Make resize return itself so we can track further calls of the Image object after
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue