Skip to content

Commit

Permalink
Test with Pyodide 0.27.2 (#183)
Browse files Browse the repository at this point in the history
* Bump to Pyodide 0.27.2

* Also run [integration] tests

* Fix `AttributeError` with `_compat_in_pyodide` [integration]

* Coloured output for tests [integration]

* Use updated `micropip` version for test [integration]

* Try: set scheme as "file" if not set

* Fix `file://` scheme insertion in test assert

* Run [integration] tests

* Don't directly instantiate `ParseResult` [integration]

* Revert "Don't directly instantiate `ParseResult` [integration]"

This reverts commit 09772c8.

* Enforce `file:///` scheme and no netloc [integration]

* Revert "Enforce `file:///` scheme and no netloc [integration]"

This reverts commit f1de916.
  • Loading branch information
agriyakhetarpal authored Jan 30, 2025
1 parent 4728a85 commit 27791c1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ concurrency:
group: main-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: 3

jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -19,12 +22,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
pyodide-version: ["0.27.0a2"]
pyodide-version: ["0.27.2"]
test-config: [
# FIXME: recent version of chrome gets timeout
{runner: selenium, runtime: chrome, runtime-version: "125" },
{runner: selenium, runtime: node, runtime-version: "22" },
]
# FIXME: recent version of chrome gets timeout
{ runner: selenium, runtime: chrome, runtime-version: "125" },
{ runner: selenium, runtime: node, runtime-version: "22" },
]

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 9 additions & 2 deletions micropip/wheelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,15 @@ def from_url(cls, url: str) -> "WheelInfo":
See https://www.python.org/dev/peps/pep-0427/#file-name-convention
"""
parsed_url = urlparse(url)
if parsed_url.scheme == "":
url = "file:///" + url
if not parsed_url.scheme:
parsed_url = ParseResult(
scheme="file",
netloc=parsed_url.netloc,
path=parsed_url.path,
params=parsed_url.params,
query=parsed_url.query,
fragment=parsed_url.fragment,
)
file_name = Path(parsed_url.path).name
name, version, build, tags = parse_wheel_filename(file_name)
return WheelInfo(
Expand Down
6 changes: 4 additions & 2 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ async def myfunc():

fetch_response_mock.string.side_effect = myfunc

@patch("micropip._compat_in_pyodide.pyfetch", return_value=fetch_response_mock)
@patch(
"micropip._compat._compat_in_pyodide.pyfetch", return_value=fetch_response_mock
)
async def call_micropip_install(pyfetch_mock):
try:
await micropip.install("pyodide-micropip-test", credentials="include")
Expand All @@ -278,7 +280,7 @@ async def test_load_binary_wheel1(

@pytest.mark.skip_refcount_check
@run_in_pyodide(packages=["micropip"])
async def test_load_binary_wheel2(selenium):
async def test_load_binary_wheel2(selenium_standalone_micropip):
from pyodide_js._api import repodata_packages

import micropip
Expand Down
3 changes: 1 addition & 2 deletions tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ def test_parse_wheel_url1(protocol, path):
url = protocol + path
wheel = WheelInfo.from_url(url)

check_url = url if protocol else "file:///" + path
assert wheel.name == "snowballstemmer"
assert str(wheel.version) == "2.0.0"
assert wheel.sha256 is None
assert wheel.filename == SNOWBALL_WHEEL
assert wheel.url == check_url
assert wheel.url == url
assert wheel.tags == frozenset(
{Tag("py2", "none", "any"), Tag("py3", "none", "any")}
)
Expand Down

0 comments on commit 27791c1

Please sign in to comment.