Skip to content

Commit

Permalink
Don't mention cors when failing to find wheel in emfs
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Feb 22, 2025
1 parent 71a87c1 commit da7c714
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion micropip/wheelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@ async def _fetch_bytes(self, url: str, fetch_kwargs: dict[str, Any]):
"cdn.jsdelivr.net",
]:
raise e
else:
if self.parsed_url.scheme in ("https", "http"):
raise ValueError(
f"Can't fetch wheel from {url!r}. "
"One common reason for this is when the server blocks "
"Cross-Origin Resource Sharing (CORS). "
"Check if the server is sending the correct 'Access-Control-Allow-Origin' header."
) from e
raise e

def _extract(self, target: Path) -> None:
assert self._data
Expand Down
10 changes: 10 additions & 0 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,16 @@ async def run_test(selenium, url, wheel_name):
run_test(selenium_standalone_micropip, snowball_wheel.url, snowball_wheel.filename)


def test_emfs_error(selenium_standalone_micropip):
@run_in_pyodide()
async def run_test(selenium):
import micropip

await micropip.install("emfs:a-2.0.2-cp312-cp312-pyodide_2024_0_wasm32.whl")

run_test(selenium_standalone_micropip)


def test_logging(selenium_standalone_micropip, wheel_catalog):
@run_in_pyodide(packages=["micropip"])
async def run_test(selenium, url, name, version):
Expand Down

0 comments on commit da7c714

Please sign in to comment.