forked from pyodide/micropip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_compat.py
More file actions
30 lines (22 loc) · 876 Bytes
/
Copy pathtest_compat.py
File metadata and controls
30 lines (22 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
test that function in compati behave the same
"""
import pytest
from pytest_pyodide import run_in_pyodide
@pytest.mark.driver_timeout(10)
def test_404(selenium_standalone_micropip, httpserver, request):
selenium_standalone_micropip.set_script_timeout(11)
@run_in_pyodide(packages=["micropip", "packaging"])
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, {})
httpserver.expect_request("/404").respond_with_data(
"Not found",
status=404,
content_type="text/plain",
headers={"Access-Control-Allow-Origin": "*"},
)
url_404 = httpserver.url_for("/404")
_inner_test_404_raise(selenium_standalone_micropip, url_404)