-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add integration tests * lint [integration] * fix path and flag [integration] * Fix pytest flag [integration] * fix test [integration] * Update tests/integration/test_integration.py Co-authored-by: Hood Chatham <[email protected]> * Update tests/integration/test_integration.py Co-authored-by: Hood Chatham <[email protected]> * Make decorator [integration] * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix test * [integration] --------- Co-authored-by: Hood Chatham <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
91773c4
commit f02e8b9
Showing
6 changed files
with
137 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Integration tests for micropip | ||
# These test often requires querying to the real packages existing in PyPI, | ||
# to test the micropip's ability to install packages from real world package indexes. | ||
|
||
# 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 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 | ||
|
||
await micropip.install("snowballstemmer") | ||
|
||
import snowballstemmer | ||
|
||
snowballstemmer.stemmer("english") | ||
|
||
_run(selenium_standalone_micropip) | ||
|
||
|
||
@integration_test_only | ||
def test_integration_list_basic(selenium_standalone_micropip, pytestconfig): | ||
@run_in_pyodide | ||
async def _run(selenium): | ||
import micropip | ||
|
||
await micropip.install("snowballstemmer") | ||
|
||
packages = micropip.list() | ||
assert "snowballstemmer" in packages | ||
|
||
_run(selenium_standalone_micropip) | ||
|
||
|
||
@integration_test_only | ||
def test_integration_uninstall_basic(selenium_standalone_micropip, pytestconfig): | ||
@run_in_pyodide | ||
async def _run(selenium): | ||
import micropip | ||
|
||
await micropip.install("snowballstemmer") | ||
|
||
import snowballstemmer | ||
|
||
snowballstemmer.stemmer("english") | ||
|
||
micropip.uninstall("snowballstemmer") | ||
|
||
packages = micropip.list() | ||
assert "snowballstemmer" not in packages | ||
|
||
_run(selenium_standalone_micropip) | ||
|
||
|
||
@integration_test_only | ||
def test_integration_freeze_basic(selenium_standalone_micropip, pytestconfig): | ||
@run_in_pyodide | ||
async def _run(selenium): | ||
import json | ||
|
||
import micropip | ||
|
||
await micropip.install("snowballstemmer") | ||
|
||
import snowballstemmer | ||
|
||
snowballstemmer.stemmer("english") | ||
|
||
lockfile = micropip.freeze() | ||
assert "snowballstemmer" in json.loads(lockfile)["packages"] | ||
|
||
_run(selenium_standalone_micropip) |
2 changes: 1 addition & 1 deletion
2
tests/test_remote_indexes.py → tests/integration/test_remote_indexes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters