From c2bc971444bd00dbd065cb5831cb92716596174e Mon Sep 17 00:00:00 2001 From: Gwenneth Straub Date: Mon, 29 Jul 2024 14:43:17 -0700 Subject: [PATCH] test_get_model_weights mac os fix --- tests/unit_tests/test_unit.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/unit_tests/test_unit.py b/tests/unit_tests/test_unit.py index fff5feab..120e341a 100644 --- a/tests/unit_tests/test_unit.py +++ b/tests/unit_tests/test_unit.py @@ -263,13 +263,14 @@ def test_get_model_weights(monkeypatch): mnk.setattr(github, "Github", mock_github) mnk.setattr(requests, "get", mock_get) - filename = os.path.join(tmp_dir, "casanovo_massivekb_v3_0_0.ckpt") - assert not os.path.isfile(filename) - result_path = casanovo._get_model_weights(pathlib.Path(tmp_dir)) - assert str(result_path.resolve()) == filename - assert os.path.isfile(filename) - result_path = casanovo._get_model_weights(pathlib.Path(tmp_dir)) - assert str(result_path.resolve()) == filename + tmp_path = pathlib.Path(tmp_dir) + filename = tmp_path / "casanovo_massivekb_v3_0_0.ckpt" + assert not filename.is_file() + result_path = casanovo._get_model_weights(tmp_path) + assert result_path == filename + assert filename.is_file() + result_path = casanovo._get_model_weights(tmp_path) + assert result_path == filename # Impossible to find model weights for (i) full version mismatch and (ii) # major version mismatch.