From 39c4e7b43bd2168d3cedd7e35bb912e6ceabeac0 Mon Sep 17 00:00:00 2001 From: Mostafa Farrag Date: Tue, 7 Jan 2025 00:46:49 +0100 Subject: [PATCH] mock the mkdir method in the Parameter constructor method in the TestParameterMock --- tests/rrm/parameters/test_parameters.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/rrm/parameters/test_parameters.py b/tests/rrm/parameters/test_parameters.py index ae5c38c9..be9d6a78 100644 --- a/tests/rrm/parameters/test_parameters.py +++ b/tests/rrm/parameters/test_parameters.py @@ -175,7 +175,9 @@ def test_download_files(self, parameter_manager, mock_api_client, tmp_path): ] } - with patch("Hapi.parameters.parameters.FileManager.download_file") as mock_download: + with patch( + "Hapi.parameters.parameters.FileManager.download_file" + ) as mock_download: parameter_manager.download_files(set_id=1, download_dir=tmp_path) mock_api_client.send_request.assert_called_once_with("GET", "articles/19999901") @@ -376,7 +378,9 @@ def mock_file_manager(self): @pytest.fixture def parameter(self, mock_parameter_manager): """Fixture to provide a Parameter instance with a mocked ParameterManager.""" - with patch("os.getenv", return_value="/mocked/path/to/data"): + with patch("os.getenv", return_value="/mocked/path/to/data"), patch( + "pathlib.Path.mkdir", return_value=None + ): parameter_instance = Parameter(version=1) parameter_instance.manager = mock_parameter_manager return parameter_instance