This is on top of #2225. The goal is to be able to skip specific tests. Many core test sets have just one test that uses subprocess or threads. Others have a few tests that are failing due to upstream problems in emscripten. I went through and switched to skipping specific tests in as many cases as I could. In modules where most or all tests use threading or subprocess, I gave up and put a comment saying something like 35/50 tests fork and I didn't want to bother to salvage the remaining ones.

In order to accommodate using patterns to skip specific tests (and also extra comments) I switched the format of `python_tests` to a yaml file. This gives us significantly more flexibility in the structure of the file and allows us to use `ruamel.yaml` to update it. We gain a lot flexibility while reducing the length of `make_test_lists.py` modestly from 108 to 78 loc.

In the future, hopefully we should be able to make fixes by deleting one skip pattern and looking into why that particular test fails.

Rework core tests. This is on top of #2225. The goal is to be able to skip specific tests. Many core test sets have just one test that uses subprocess or threads. Others have a few tests that are failing due to upstream problems in emscripten. I went through and switched to skipping specific tests in as many cases as I could. In modules where most or all tests use threading or subprocess, I gave up and put a comment saying something like 35/50 tests fork and I didn't want to bother to salvage the remaining ones.

In order to accommodate using patterns to skip specific tests (and also extra comments) I switched the format of `python_tests` to a yaml file. This gives us significantly more flexibility in the structure of the file and allows us to use `ruamel.yaml` to update it. We gain a lot flexibility while reducing the length of `make_test_lists.py` modestly from 108 to 78 loc.

In the future, hopefully we should be able to make fixes by deleting one skip pattern and looking into why that particular test fails.

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(packages=["wrapt"])
def test_wrapt():
    import inspect
    import unittest

    import wrapt

    @wrapt.decorator
    def passthru_decorator(wrapped, instance, args, kwargs):
        return wrapped(*args, **kwargs)

    def function1(arg):
        """documentation"""
        return arg

    function1o = function1
    function1d = passthru_decorator(function1)
    assert function1d is not function1o

    class TestNamingFunction(unittest.TestCase):
        def test_object_name(self):
            # Test preservation of function __name__ attribute.

            self.assertEqual(function1d.__name__, function1o.__name__)

        def test_object_qualname(self):
            # Test preservation of function __qualname__ attribute.

            try:
                __qualname__ = function1o.__qualname__
            except AttributeError:
                pass
            else:
                self.assertEqual(function1d.__qualname__, __qualname__)

        def test_module_name(self):
            # Test preservation of function __module__ attribute.

            self.assertEqual(function1d.__module__, __name__)

        def test_doc_string(self):
            # Test preservation of function __doc__ attribute.

            self.assertEqual(function1d.__doc__, function1o.__doc__)

        def test_argspec(self):
            # Test preservation of function argument specification.

            function1o_argspec = inspect.getargspec(function1o)
            function1d_argspec = inspect.getargspec(function1d)
            self.assertEqual(function1o_argspec, function1d_argspec)

        def test_isinstance(self):
            # Test preservation of isinstance() checks.

            self.assertTrue(isinstance(function1d, type(function1o)))

    class TestCallingFunction(unittest.TestCase):
        def test_call_function(self):
            _args = (1, 2)
            _kwargs = {"one": 1, "two": 2}

            @wrapt.decorator
            def _decorator(wrapped, instance, args, kwargs):
                self.assertEqual(instance, None)
                self.assertEqual(args, _args)
                self.assertEqual(kwargs, _kwargs)
                return wrapped(*args, **kwargs)

            @_decorator
            def _function(*args, **kwargs):
                return args, kwargs

            result = _function(*_args, **_kwargs)

            self.assertEqual(result, (_args, _kwargs))

    # Run tests
    with unittest.TestCase().assertRaisesRegex(SystemExit, "False"):
        unittest.main()

from pyodide_build.testing import run_in_pyodide


@run_in_pyodide(packages=["wrapt"])
def test_wrapt():
    import inspect
    import unittest

    import wrapt

    @wrapt.decorator
    def passthru_decorator(wrapped, instance, args, kwargs):
        return wrapped(*args, **kwargs)

    def function1(arg):
        """documentation"""
        return arg

    function1o = function1
    function1d = passthru_decorator(function1)
    assert function1d is not function1o

    class TestNamingFunction(unittest.TestCase):
        def test_object_name(self):
            # Test preservation of function __name__ attribute.

            self.assertEqual(function1d.__name__, function1o.__name__)

        def test_object_qualname(self):
            # Test preservation of function __qualname__ attribute.

            try:
                __qualname__ = function1o.__qualname__
            except AttributeError:
                pass
            else:
                self.assertEqual(function1d.__qualname__, __qualname__)

        def test_module_name(self):
            # Test preservation of function __module__ attribute.

            self.assertEqual(function1d.__module__, __name__)

        def test_doc_string(self):
            # Test preservation of function __doc__ attribute.

            self.assertEqual(function1d.__doc__, function1o.__doc__)

        def test_argspec(self):
            # Test preservation of function argument specification.

            function1o_argspec = inspect.getargspec(function1o)
            function1d_argspec = inspect.getargspec(function1d)
            self.assertEqual(function1o_argspec, function1d_argspec)

        def test_isinstance(self):
            # Test preservation of isinstance() checks.

            self.assertTrue(isinstance(function1d, type(function1o)))

    class TestCallingFunction(unittest.TestCase):
        def test_call_function(self):
            _args = (1, 2)
            _kwargs = {"one": 1, "two": 2}

            @wrapt.decorator
            def _decorator(wrapped, instance, args, kwargs):
                self.assertEqual(instance, None)
                self.assertEqual(args, _args)
                self.assertEqual(kwargs, _kwargs)
                return wrapped(*args, **kwargs)

            @_decorator
            def _function(*args, **kwargs):
                return args, kwargs

            result = _function(*_args, **_kwargs)

            self.assertEqual(result, (_args, _kwargs))

    # Run tests
    with unittest.TestCase().assertRaisesRegex(SystemExit, "False"):
        unittest.main()
