mirror of https://github.com/pyodide/pyodide.git
TST xfail the pillow test that fails on Chrome (#1222)
This commit is contained in:
parent
b46acbadc2
commit
a4907839dd
|
@ -35,15 +35,11 @@ def generate_largish_json(n_rows: int = 91746) -> Dict:
|
||||||
|
|
||||||
|
|
||||||
def test_pandas(selenium, request):
|
def test_pandas(selenium, request):
|
||||||
if selenium.browser == "chrome":
|
|
||||||
request.applymarker(pytest.mark.xfail(run=False, reason="chrome not supported"))
|
|
||||||
selenium.load_package("pandas")
|
selenium.load_package("pandas")
|
||||||
assert len(selenium.run("import pandas\ndir(pandas)")) == 142
|
assert len(selenium.run("import pandas\ndir(pandas)")) == 142
|
||||||
|
|
||||||
|
|
||||||
def test_extra_import(selenium, request):
|
def test_extra_import(selenium, request):
|
||||||
if selenium.browser == "chrome":
|
|
||||||
request.applymarker(pytest.mark.xfail(run=False, reason="chrome not supported"))
|
|
||||||
|
|
||||||
selenium.load_package("pandas")
|
selenium.load_package("pandas")
|
||||||
selenium.run("from pandas import Series, DataFrame, Panel")
|
selenium.run("from pandas import Series, DataFrame, Panel")
|
||||||
|
@ -52,9 +48,6 @@ def test_extra_import(selenium, request):
|
||||||
def test_load_largish_file(selenium_standalone, request, httpserver):
|
def test_load_largish_file(selenium_standalone, request, httpserver):
|
||||||
selenium = selenium_standalone
|
selenium = selenium_standalone
|
||||||
|
|
||||||
if selenium.browser == "chrome":
|
|
||||||
request.applymarker(pytest.mark.xfail(run=False, reason="chrome not supported"))
|
|
||||||
|
|
||||||
selenium.load_package("pandas")
|
selenium.load_package("pandas")
|
||||||
selenium.load_package("matplotlib")
|
selenium.load_package("matplotlib")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import pytest
|
||||||
from pyodide_build.testing import run_in_pyodide
|
from pyodide_build.testing import run_in_pyodide
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.xfail
|
||||||
@run_in_pyodide(packages=["pillow"])
|
@run_in_pyodide(packages=["pillow"])
|
||||||
def test_pillow():
|
def test_pillow():
|
||||||
from PIL import Image, ImageDraw, ImageOps
|
from PIL import Image, ImageDraw, ImageOps
|
||||||
|
@ -16,17 +18,19 @@ def test_pillow():
|
||||||
img.tobytes()
|
img.tobytes()
|
||||||
== b"\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00"
|
== b"\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00"
|
||||||
)
|
)
|
||||||
byio = io.BytesIO()
|
with io.BytesIO() as byio:
|
||||||
img.save(byio, format="PNG")
|
img.save(byio, format="PNG")
|
||||||
assert (
|
|
||||||
byio.getvalue()
|
assert (
|
||||||
== b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x04\x00\x00\x00\x04\x08\x02\x00\x00\x00&\x93\t)\x00\x00\x00\x1cIDATx\x9cc\xfc\xcf\x80\x04`\x9c\xff\xff\x19\x18\x98`\x02\x8c\x0c\x0c\x0c\x8c\xc8\xca\x00\xb5\x05\x06\x00\xcbi8B\x00\x00\x00\x00IEND\xaeB`\x82"
|
byio.getvalue()
|
||||||
)
|
== b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x04\x00\x00\x00\x04\x08\x02\x00\x00\x00&\x93\t)\x00\x00\x00\x1cIDATx\x9cc\xfc\xcf\x80\x04`\x9c\xff\xff\x19\x18\x98`\x02\x8c\x0c\x0c\x0c\x8c\xc8\xca\x00\xb5\x05\x06\x00\xcbi8B\x00\x00\x00\x00IEND\xaeB`\x82"
|
||||||
img = Image.open(byio)
|
)
|
||||||
assert (
|
img = Image.open(byio)
|
||||||
img.tobytes()
|
assert (
|
||||||
== b"\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00"
|
img.tobytes()
|
||||||
)
|
== b"\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00"
|
||||||
asjpg = io.BytesIO()
|
)
|
||||||
img.save(asjpg, format="JPEG")
|
|
||||||
img = Image.open(asjpg)
|
with io.BytesIO() as asjpg:
|
||||||
|
img.save(asjpg, format="JPEG")
|
||||||
|
img = Image.open(asjpg)
|
||||||
|
|
|
@ -3,8 +3,6 @@ import pytest
|
||||||
|
|
||||||
def test_scikit_learn(selenium_standalone, request):
|
def test_scikit_learn(selenium_standalone, request):
|
||||||
selenium = selenium_standalone
|
selenium = selenium_standalone
|
||||||
if selenium.browser == "chrome":
|
|
||||||
request.applymarker(pytest.mark.xfail(run=False, reason="chrome not supported"))
|
|
||||||
selenium.load_package("scikit-learn")
|
selenium.load_package("scikit-learn")
|
||||||
assert (
|
assert (
|
||||||
selenium.run(
|
selenium.run(
|
||||||
|
|
|
@ -6,9 +6,6 @@ import pytest
|
||||||
def test_scipy_linalg(selenium_standalone, request):
|
def test_scipy_linalg(selenium_standalone, request):
|
||||||
selenium = selenium_standalone
|
selenium = selenium_standalone
|
||||||
|
|
||||||
if selenium.browser == "chrome":
|
|
||||||
request.applymarker(pytest.mark.xfail(run=False, reason="chrome not supported"))
|
|
||||||
|
|
||||||
selenium.load_package("scipy")
|
selenium.load_package("scipy")
|
||||||
cmd = dedent(
|
cmd = dedent(
|
||||||
r"""
|
r"""
|
||||||
|
|
|
@ -26,7 +26,7 @@ def registered_packages_meta():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UNSUPPORTED_PACKAGES = {"chrome": ["pandas", "scipy", "scikit-learn"], "firefox": []}
|
UNSUPPORTED_PACKAGES = {"chrome": [], "firefox": []}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("name", registered_packages())
|
@pytest.mark.parametrize("name", registered_packages())
|
||||||
|
@ -68,34 +68,9 @@ def test_import(name, selenium_standalone):
|
||||||
))
|
))
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
selenium_standalone.load_package(name)
|
|
||||||
|
|
||||||
# Make sure there are no additional .pyc file
|
|
||||||
assert (
|
|
||||||
selenium_standalone.run(
|
|
||||||
"""
|
|
||||||
len(list(glob.glob(
|
|
||||||
'/lib/python3.8/site-packages/**/*.pyc',
|
|
||||||
recursive=True)
|
|
||||||
))
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
== baseline_pyc
|
|
||||||
)
|
|
||||||
|
|
||||||
loaded_packages = []
|
loaded_packages = []
|
||||||
for import_name in meta.get("test", {}).get("imports", []):
|
for import_name in meta.get("test", {}).get("imports", []):
|
||||||
|
selenium_standalone.run_async("import %s" % import_name)
|
||||||
if name not in loaded_packages:
|
|
||||||
selenium_standalone.load_package(name)
|
|
||||||
loaded_packages.append(name)
|
|
||||||
try:
|
|
||||||
selenium_standalone.run("import %s" % import_name)
|
|
||||||
except Exception:
|
|
||||||
print(selenium_standalone.logs)
|
|
||||||
raise
|
|
||||||
|
|
||||||
# Make sure that even after importing, there are no additional .pyc
|
# Make sure that even after importing, there are no additional .pyc
|
||||||
# files
|
# files
|
||||||
assert (
|
assert (
|
||||||
|
|
Loading…
Reference in New Issue