diff --git a/tests/test_compat.py b/tests/test_compat.py index 842e611..6300eab 100644 --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -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)