diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 9f26de3..6725b72 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -5,12 +5,20 @@ # To prevent sending many requests to remote servers, these tests are disabled by default. # To run these tests locally, invoke pytest with the `--integration` flag. +import pytest from pytest_pyodide import run_in_pyodide -def test_integration_install_basic(selenium_standalone_micropip, pytestconfig): - pytestconfig.getoption("--integration", skip=True) +def integration_test_only(func): + def wrapper(selenium_standalone_micropip, pytestconfig): + if not pytestconfig.getoption("--integration"): + pytest.skip("Integration tests are skipped. Use --integration to run them.") + func(selenium_standalone_micropip, pytestconfig) + return wrapper + +@integration_test_only +def test_integration_install_basic(selenium_standalone_micropip, pytestconfig): @run_in_pyodide async def _run(selenium): import micropip @@ -24,9 +32,8 @@ async def _run(selenium): _run(selenium_standalone_micropip) +@integration_test_only def test_integration_list_basic(selenium_standalone_micropip, pytestconfig): - pytestconfig.getoption("--integration", skip=True) - @run_in_pyodide async def _run(selenium): import micropip @@ -39,9 +46,8 @@ async def _run(selenium): _run(selenium_standalone_micropip) +@integration_test_only def test_integration_uninstall_basic(selenium_standalone_micropip, pytestconfig): - pytestconfig.getoption("--integration", skip=True) - @run_in_pyodide async def _run(selenium): import micropip @@ -60,9 +66,8 @@ async def _run(selenium): _run(selenium_standalone_micropip) +@integration_test_only def test_integration_freeze_basic(selenium_standalone_micropip, pytestconfig): - pytestconfig.getoption("--integration", skip=True) - @run_in_pyodide async def _run(selenium): import json diff --git a/tests/integration/test_remote_indexes.py b/tests/integration/test_remote_indexes.py index c8b9c18..f5bc808 100644 --- a/tests/integration/test_remote_indexes.py +++ b/tests/integration/test_remote_indexes.py @@ -1,7 +1,7 @@ # This file contains tests that actually query remote package indexes, # to ensure that micropip works with real-world package indexes. # Since running these tests will send many requests to remote servers, -# these tests are disabled by default in CI. +# these tests are disabled by default in CI and local testing. # # To run these tests, add `--run-remote-index-tests` flag, or # these tests can also be run in Github Actions manually. diff --git a/tests/test_install.py b/tests/test_install.py index aa89b0e..aa0d22e 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -6,28 +6,6 @@ import micropip -def test_install_simple(selenium_standalone_micropip): - selenium = selenium_standalone_micropip - assert ( - selenium.run_js( - """ - return await pyodide.runPythonAsync(` - import os - import micropip - from pyodide.ffi import to_js - # Package 'pyodide-micropip-test' has dependency on 'snowballstemmer' - # It is used to test markers support - await micropip.install('pyodide-micropip-test') - import snowballstemmer - stemmer = snowballstemmer.stemmer('english') - to_js(stemmer.stemWords('go going goes gone'.split())) - `); - """ - ) - == ["go", "go", "goe", "gone"] - ) - - def test_install_custom_url(selenium_standalone_micropip, wheel_catalog): selenium = selenium_standalone_micropip snowball_wheel = wheel_catalog.get("snowballstemmer")