MAINT Add pytest.mark.xfail_browsers and use it to reduce boilerplate. Use a decorator to indicate which browsers we want to xfail test. This works for `run_in_pyodide` as well as normal tests.
from pyodide_test_runner import run_in_pyodide


@run_in_pyodide(
    selenium_fixture_name="selenium_standalone", packages=["numpy", "imageio"]
)
def test_imageio():
    import imageio
    import numpy as np

    filename = "/tmp/foo.tif"
    image_in = np.random.randint(0, 65535, size=(100, 36), dtype=np.uint16)
    imageio.imwrite(filename, image_in)
    image_out = imageio.imread(filename)
    assert image_out.shape == (100, 36)
    np.testing.assert_equal(image_in, image_out)


@run_in_pyodide(packages=["numpy", "imageio"])
def test_jpg():
    import imageio
    import numpy as np

    img = np.zeros((5, 5), dtype=np.uint8)
    imageio.imsave("img.jpg", img)
    assert (imageio.imread("img.jpg") == img).all()

from pyodide_test_runner import run_in_pyodide


@run_in_pyodide(
    selenium_fixture_name="selenium_standalone", packages=["numpy", "imageio"]
)
def test_imageio():
    import imageio
    import numpy as np

    filename = "/tmp/foo.tif"
    image_in = np.random.randint(0, 65535, size=(100, 36), dtype=np.uint16)
    imageio.imwrite(filename, image_in)
    image_out = imageio.imread(filename)
    assert image_out.shape == (100, 36)
    np.testing.assert_equal(image_in, image_out)


@run_in_pyodide(packages=["numpy", "imageio"])
def test_jpg():
    import imageio
    import numpy as np

    img = np.zeros((5, 5), dtype=np.uint8)
    imageio.imsave("img.jpg", img)
    assert (imageio.imread("img.jpg") == img).all()
