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

Remove JsException unpickle special case #91

Merged
merged 11 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
build-artifact-name: none
build-artifact-path: none
pyodide-versions: "[0.23.2,0.22.0,0.21.3]"
pyodide-versions: "[0.23.2,0.22.0]"

deploy:
runs-on: ubuntu-20.04
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/filtermatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# the configs below
pyodide_versions = sys.argv[1]
if pyodide_versions == "*":
pyodide_versions = "[0.22.0,0.21.0]"
pyodide_versions = "[0.23.2,0.22.0]"

matrix = yaml.safe_load(
"""
Expand All @@ -33,15 +33,15 @@
]
include:
- os: macos-11
pyodide-version: 0.21.0
pyodide-version: 0.23.2
test-config: {runner: selenium, browser: safari}
# the following two tests check that the fallback browser behaviour works
# okay (this is because ubuntu 22.04 doesn't support getting python 3.10.2)
- os: ubuntu-latest
pyodide-version: 0.21.0
pyodide-version: 0.23.2
test-config: {runner: selenium, browser: node, browser-version: 18}
- os: ubuntu-22.04
pyodide-version: 0.21.0
pyodide-version: 0.23.2
test-config: {runner: selenium, browser: node, browser-version: 18}
"""
)
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
pyodide-version:
required: false
type: string
default: "0.21.0"
default: "0.23.2"
runner:
required: false
type: string
Expand Down Expand Up @@ -132,6 +132,12 @@ jobs:
name: ${{ inputs.build-artifact-name }}
path: ${{ inputs.build-artifact-path }}

- name: install pyodide-py
shell: bash -l {0}
run: |
${{needs.get_versions.outputs.pythonexec}} -m pip install pyodide-py==${{inputs.pyodide-version}}


- name: Install pytest-pyodide
shell: bash -l {0}
run: |
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Unreleased

- Removed `JsException` unpickle special case. This was fixed by
[pyodide/pyodide#3387](https://github.com/pyodide/pyodide/pull/3387).
[#91](https://github.com/pyodide/pytest-pyodide/pull/91)

- Dropped support for Pyodide version `0.21.x`.
Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable to me.

[#91](https://github.com/pyodide/pytest-pyodide/pull/91)

## [0.51.0] - 2023-05-10

- Added test templates files in the package.
Expand Down
2 changes: 1 addition & 1 deletion COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Other versions may work, however with no guarantee.
| 0.23.* | 0.21.0 |
| 0.50.0 | 0.22.0, 0.21.3 |
| 0.51.0 | 0.23.2, 0.22.0, 0.21.3 |
| main branch | 0.23.2, 0.22.0, 0.21.3 |
| main branch | 0.23.2, 0.22.0 |
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ This will run your tests on the given browser/pyodide version/OS configuration.

```
jobs:
# Build for pyodide 0.21.0
# Build for pyodide 0.23.2
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.10.2
python-version: 3.11
- uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.14
- run: pip install pyodide-build==0.21.0
version: 3.1.32
- run: pip install pyodide-build==0.23.2
- run: pyodide build
- uses: actions/upload-artifact@v3
with:
Expand All @@ -55,7 +55,7 @@ jobs:
build-artifact-path: dist
browser: firefox
runner: selenium
pyodide-version: 0.21.0
pyodide-version: 0.23.2
```

If you want to run on multiple browsers / pyodide versions etc., you can either use a matrix strategy and run main.yaml as above, or you can use testall.yaml. This by default tests on all browsers (and node) with multiple configurations. If you want to reduce the configurations you can filter with lists of browsers, runners, pyodide-versions as shown below.
Expand All @@ -66,7 +66,7 @@ If you want to run on multiple browsers / pyodide versions etc., you can either
with:
build-artifact-name: pyodide wheel
build-artifact-path: dist
pyodide-versions: [0.21.0,0.23.0]
pyodide-versions: [0.22.0,0.23.2]
runners: [selenium,playwright]
browsers: [firefox,chrome,node]
os: [ubuntu-latest,macos-latest]
Expand All @@ -76,8 +76,8 @@ If you want to run on multiple browsers / pyodide versions etc., you can either

1. First you need a compatible version of Pyodide. You can download the Pyodide build artifacts from releases with,
```bash
wget https://github.com/pyodide/pyodide/releases/download/0.21.0/pyodide-build-0.21.0.tar.bz2
tar xjf pyodide-build-0.21.0.tar.bz2
wget https://github.com/pyodide/pyodide/releases/download/0.23.2/pyodide-build-0.23.2.tar.bz2
tar xjf pyodide-build-0.23.2.tar.bz2
mv pyodide dist/
```

Expand Down
11 changes: 0 additions & 11 deletions pytest_pyodide/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .copy_files_to_pyodide import copy_files_to_emscripten_fs
from .hook import ORIGINAL_MODULE_ASTS, REWRITTEN_MODULE_ASTS
from .pyodide import JsException
from .runner import _BrowserBaseRunner
from .utils import package_is_built as _package_is_built

Expand Down Expand Up @@ -56,16 +55,6 @@ def persistent_load(self, pid: Any) -> Any:
# reference count.
return PyodideHandle(self.selenium, ptr)

def find_class(self, module: str, name: str) -> Any:
"""
Catch exceptions that only exist in the pyodide environment and
convert them to exception in the host.
"""
if module in ("pyodide", "pyodide.ffi") and name == "JsException":
return JsException
else:
return super().find_class(module, name)


class Pickler(pickle.Pickler):
def persistent_id(self, obj: Any) -> Any:
Expand Down
15 changes: 0 additions & 15 deletions pytest_pyodide/pyodide.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_decorator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
from hypothesis import given, settings

from pyodide.ffi import JsException
from pytest_pyodide.decorator import run_in_pyodide
from pytest_pyodide.hypothesis import any_strategy, std_hypothesis_settings
from pytest_pyodide.pyodide import JsException
from pytest_pyodide.utils import parse_driver_timeout


Expand Down