@@ -101,15 +101,15 @@ def setUp(self, _: MagicMock):
101101 self .request_handler : RequestHandler = RequestHandler ((self .TEST_EVENT_BYTES , self .mock_socket ),
102102 (self .TEST_HOST , self .TEST_PORT ), self .mock_server )
103103
104- @patch ("site.getsitepackages " )
104+ @patch ("site.getusersitepackages " )
105105 @patch ("ctypes.cdll.LoadLibrary" )
106106 @patch ("ctypes.CDLL" )
107107 @patch ("platform.system" , return_value = "Windows" )
108108 def test_windows_dll_verification (self ,
109109 _ : MagicMock ,
110110 cdll_construction_mock : MagicMock ,
111111 cdll_load_mock : MagicMock ,
112- site_packages_mock : MagicMock ):
112+ user_site_packages_mock : MagicMock ):
113113 """
114114 Ensure that the miniupnpc DLL is correctly manually loaded or not manually loaded, depending on whether it has
115115 already been automatically loaded.
@@ -129,16 +129,16 @@ def test_windows_dll_verification(self,
129129 # manually loaded from source.
130130 cdll_construction_mock .assert_called_with ("miniupnpc.dll" )
131131 cdll_load_mock .assert_called_with ("source/resources/dll/miniupnpc.dll" )
132- # Simulate the package case by mocking out the site-packages path and sys.modules.
133- site_packages_path : str = "/tmp/site-packages"
134- site_packages_mock .return_value = [ site_packages_path ]
132+ # Simulate the package case by mocking out the user site-packages path and sys.modules.
133+ user_site_packages_path : str = "/tmp/site-packages"
134+ user_site_packages_mock .return_value = user_site_packages_path
135135 # This mock is definitely not normal, but it does serve our purpose by defining the key against a real module.
136136 sys .modules ["microcosm" ] = event_listener
137137 importlib .reload (event_listener )
138138 # In this case, we also expect an attempt to be made to construct the DLL object, but this time we expect the
139- # DLL to be manually loaded from site-packages.
139+ # DLL to be manually loaded from user site-packages.
140140 cdll_construction_mock .assert_called_with ("miniupnpc.dll" )
141- cdll_load_mock .assert_called_with (f"{ site_packages_path } /microcosm/source/resources/dll/miniupnpc.dll" )
141+ cdll_load_mock .assert_called_with (f"{ user_site_packages_path } /microcosm/source/resources/dll/miniupnpc.dll" )
142142
143143 def test_handle (self ):
144144 """
0 commit comments