diff --git a/modules/map/lib.py b/modules/map/lib.py index 595fb64e..0107b430 100644 --- a/modules/map/lib.py +++ b/modules/map/lib.py @@ -252,9 +252,9 @@ def seconds_to_import_rpi5(size_in_bytes: int) -> int: return max(int(size_in_bytes // RPI5_PBF_BYTES_PER_SECOND), 0) -def seconds_to_import(size_in_bytes: int) -> int: +def seconds_to_import(size_in_bytes: int, is_rpi_5: bool = IS_RPI5) -> int: """Attempt to predict how long it will take an RPi4 to import a given PBF file.""" - if IS_RPI5: + if is_rpi_5: return seconds_to_import_rpi5(size_in_bytes) # Default to RPi4, because it's the most conservative estimate. diff --git a/modules/map/test/test_lib.py b/modules/map/test/test_lib.py index e5233a2f..8e31d4cf 100644 --- a/modules/map/test/test_lib.py +++ b/modules/map/test/test_lib.py @@ -1,4 +1,3 @@ -import unittest.mock from unittest import mock import pytest @@ -100,8 +99,7 @@ def test_seconds_to_import_rpi4(size, expected): (11346305075, 188040), ]) def test_seconds_to_import_rpi5(size, expected): - with unittest.mock.patch('modules.map.lib.IS_RPI5', True): - assert lib.seconds_to_import(size) == expected + assert lib.seconds_to_import(size, True) == expected def test_get_custom_map_directory(test_directory, test_config):