### Description

Close #2226

Refactors matplotlib tests:

- Prevent dangling selenium webdriver after test
- For asynchronous tests, use promise-await instead of selenium WebDriverWait
- Enable xfailed tests

<!--
- [ ] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
- [ ] Add / update tests
- [ ] Add new / update outdated documentation
!-->

Refactor matplotlib tests. ### Description

Close #2226

Refactors matplotlib tests:

- Prevent dangling selenium webdriver after test
- For asynchronous tests, use promise-await instead of selenium WebDriverWait
- Enable xfailed tests

<!--
- [ ] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
- [ ] Add / update tests
- [ ] Add new / update outdated documentation
!-->

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide
def test_bz2():
    import bz2

    text = "Hello test test test test this is a test test test"
    some_compressed_bytes = bz2.compress(text.encode("utf-8"))
    assert some_compressed_bytes != text
    decompressed_bytes = bz2.decompress(some_compressed_bytes)
    assert decompressed_bytes.decode("utf-8") == text

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide
def test_bz2():
    import bz2

    text = "Hello test test test test this is a test test test"
    some_compressed_bytes = bz2.compress(text.encode("utf-8"))
    assert some_compressed_bytes != text
    decompressed_bytes = bz2.decompress(some_compressed_bytes)
    assert decompressed_bytes.decode("utf-8") == text
