Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST Add a fixture for testing wheels from external URL #94

Merged
merged 11 commits into from
Jan 29, 2024

Conversation

ryanking13
Copy link
Member

Adds a pytest fixture that simplifies installing a wheel from external URL.

This replaces a common pattern we use when testing a wheel, which is:

with spawn_web_server(TEST_WHEEL_DIR) as server:
        server_hostname, server_port, _ = server
        url = f"http://{server_hostname}:{server_port}/"
        wheel_url = url+"....whl"

        micropip.install(wheel_url)

with:

pkg = test_wheel_catalog.get("<pkg_name>")
pkg.url
micropip.install(pkg_url)

Copy link
Member

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this maintenance work @ryanking13!

tests/conftest.py Outdated Show resolved Hide resolved
Comment on lines 37 to 45
selenium.run_js(
f"""
await pyodide.runPythonAsync(`
import micropip
await micropip.install('{url}')
import snowballstemmer
`);
"""
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe while we're att it we should transform this one to use @run_in_pyodide:

Suggested change
selenium.run_js(
f"""
await pyodide.runPythonAsync(`
import micropip
await micropip.install('{url}')
import snowballstemmer
`);
"""
)
@run_in_pyodide
def install_from_url(url):
import micropip
await micropip.install(url)
import snowballstemmer
install_from_url(url)

@ryanking13
Copy link
Member Author

Thanks for the review!

@ryanking13 ryanking13 merged commit 7f3c638 into pyodide:main Jan 29, 2024
6 checks passed
@ryanking13 ryanking13 deleted the fixture-httpserver branch January 29, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants