@@ -163,7 +163,7 @@ def test_sync_session_upload_file_raises_hyperbrowser_error_for_missing_path(tmp
163163 manager = SyncSessionManager (_FakeClient (_SyncTransport ()))
164164 missing_path = tmp_path / "missing-file.txt"
165165
166- with pytest .raises (HyperbrowserError , match = "Failed to open upload file " ):
166+ with pytest .raises (HyperbrowserError , match = "Upload file not found " ):
167167 manager .upload_file ("session_123" , missing_path )
168168
169169
@@ -172,7 +172,24 @@ def test_async_session_upload_file_raises_hyperbrowser_error_for_missing_path(tm
172172 missing_path = tmp_path / "missing-file.txt"
173173
174174 async def run ():
175- with pytest .raises (HyperbrowserError , match = "Failed to open upload file " ):
175+ with pytest .raises (HyperbrowserError , match = "Upload file not found " ):
176176 await manager .upload_file ("session_123" , missing_path )
177177
178178 asyncio .run (run ())
179+
180+
181+ def test_sync_session_upload_file_rejects_directory_path (tmp_path ):
182+ manager = SyncSessionManager (_FakeClient (_SyncTransport ()))
183+
184+ with pytest .raises (HyperbrowserError , match = "must point to a file" ):
185+ manager .upload_file ("session_123" , tmp_path )
186+
187+
188+ def test_async_session_upload_file_rejects_directory_path (tmp_path ):
189+ manager = AsyncSessionManager (_FakeClient (_AsyncTransport ()))
190+
191+ async def run ():
192+ with pytest .raises (HyperbrowserError , match = "must point to a file" ):
193+ await manager .upload_file ("session_123" , tmp_path )
194+
195+ asyncio .run (run ())
0 commit comments