Skip to content

Commit a0a5b54

Browse files
authored
Don't mention cors when failing to find wheel in emfs (#216)
1 parent 0d56038 commit a0a5b54

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

micropip/wheelinfo.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,14 @@ async def _fetch_bytes(self, url: str, fetch_kwargs: dict[str, Any]):
207207
"cdn.jsdelivr.net",
208208
]:
209209
raise e
210-
else:
210+
if self.parsed_url.scheme in ("https", "http"):
211211
raise ValueError(
212212
f"Can't fetch wheel from {url!r}. "
213213
"One common reason for this is when the server blocks "
214214
"Cross-Origin Resource Sharing (CORS). "
215215
"Check if the server is sending the correct 'Access-Control-Allow-Origin' header."
216216
) from e
217+
raise e
217218

218219
def _extract(self, target: Path) -> None:
219220
assert self._data

tests/test_install.py

+14
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,20 @@ async def run_test(selenium, url, wheel_name):
355355
run_test(selenium_standalone_micropip, snowball_wheel.url, snowball_wheel.filename)
356356

357357

358+
def test_emfs_error(selenium_standalone_micropip):
359+
@run_in_pyodide()
360+
async def run_test(selenium):
361+
import micropip
362+
363+
await micropip.install("emfs:a-2.0.2-cp312-cp312-pyodide_2024_0_wasm32.whl")
364+
365+
with pytest.raises(
366+
FileNotFoundError,
367+
match="No such file or directory: 'a-2.0.2-cp312-cp312-pyodide_2024_0_wasm32.whl'",
368+
):
369+
run_test(selenium_standalone_micropip)
370+
371+
358372
def test_logging(selenium_standalone_micropip, wheel_catalog):
359373
@run_in_pyodide(packages=["micropip"])
360374
async def run_test(selenium, url, name, version):

0 commit comments

Comments
 (0)