Apply suggestions from code review of branch yet-another-smart-scan-refactor

Co-authored-by: Beth Probert <beth_probert@outlook.com>
This commit is contained in:
Julian Stirling 2025-08-07 13:55:47 +00:00
parent 7727d0a51d
commit 5caae613dc
5 changed files with 13 additions and 12 deletions

View file

@ -63,7 +63,7 @@ def test_set_final_data():
# Quickly take 123 images!
scan_data.image_count += 123
# Should set duration based of finishing at datetime.now()
# Should set duration based on finishing at datetime.now()
scan_data.set_final_data(result="Success")
expected_duration = datetime.now() - MOCK_START_TIME
expected_duration_s = expected_duration.total_seconds()
@ -86,7 +86,7 @@ def test_custom_serialisation():
scan_data.image_count += 123
scan_data.set_final_data(result="Success")
# Can't mock datetime.now as datetime is immutable. So just replace duraction
# Can't mock datetime.now as datetime is immutable. So just replace duration
scan_data.duration = MOCK_END_TIME - scan_data.start_time
scan_data_dict = json.loads(scan_data.model_dump_json())
assert scan_data_dict["image_count"] == 123

View file

@ -309,6 +309,9 @@ def test_get_scan_data_path():
# Remove the images directory.
shutil.rmtree(scan_dir.images_dir)
# When the images directory is deleted, internally `scan_dir.images_dir`
# will return `None`. Check that `get_scan_data_path` copes with the `None`
# return from `scan_dir.images_dir`.
assert scan_dir_manager.get_scan_data_path(scan_name) is None

View file

@ -169,7 +169,7 @@ def _validation_error_tester(scan_path, **kwargs):
def test_validation_error():
"""Test a number of way to try to inject malicious arguments into the stitcher.
"""Test a number of ways to try to inject malicious arguments into the stitcher.
The stitcher should throw a validation error each attempt.
"""