From ed9012bb1b26c24d5e0b29c7ff2d6e1a39bac3ce Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 2 Jul 2024 14:12:04 -0700 Subject: [PATCH] Properly mock sys.version to avoid test contamination. --- tests/testapp/tests/test_uuid_utilities.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/testapp/tests/test_uuid_utilities.py b/tests/testapp/tests/test_uuid_utilities.py index 74c7c1c..de48dfd 100644 --- a/tests/testapp/tests/test_uuid_utilities.py +++ b/tests/testapp/tests/test_uuid_utilities.py @@ -1,5 +1,4 @@ import hashlib -import sys import uuid import mock @@ -100,6 +99,7 @@ def test_same_node_id(self): @mock.patch("platform.platform", return_value="Windows 3.1") @mock.patch("platform.node", return_value="myhost") @mock.patch("morango.models.utils._get_database_path", return_value="") + @mock.patch('sys.version', '2.7.333') def test_consistent_with_0_4_instance_id_calculation(self, *args): """ This test ensures that we don't accidentally make changes that impact how we calculate @@ -108,8 +108,6 @@ def test_consistent_with_0_4_instance_id_calculation(self, *args): from morango.models.utils import _get_database_path - sys.version = "2.7.333" - DatabaseIDModel.objects.all().update(current=False) database_id = DatabaseIDModel.objects.create( id="6fe445b75cea11858c00fb97bdee8878", current=True