Skip to content

Commit

Permalink
just @run_in_pyodide shoudl work with async
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Aug 23, 2024
1 parent 64c52cf commit 6d73dd2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
"""

import pytest
from pytest_pyodide import run_in_pyodide

from micropip._compat import HttpStatusError, fetch_string_and_headers

def test_404(selenium_standalone_micropip, httpserver):
@run_in_pyodide
async def _inner_test_404_raise(selenium, url):
import pytest

from micropip._compat import HttpStatusError, fetch_string_and_headers

with pytest.raises(HttpStatusError):
await fetch_string_and_headers(url, {})

@pytest.mark.asyncio
@run_in_pyodide
async def test_404_raise(httpserver):
httpserver.expect_request("/404").respond_with_data(
"Not found", status=404, content_type="text/plain"
)
with pytest.raises(HttpStatusError):
await fetch_string_and_headers(httpserver.url_for("/404"), {})
url_404 = httpserver.url_for("/404")
_inner_test_404_raise(selenium_standalone_micropip, url_404)

0 comments on commit 6d73dd2

Please sign in to comment.