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 fcd212640bb74988c31d3ba434bcac83cbcb087c Mon Sep 17 00:00:00 2001
From: Hood <hood@mit.edu>
Date: Thu, 24 Jun 2021 14:55:10 -0700
Subject: [PATCH 08/10] xfail core ctypes tests that don't work

PyCode_SetExtra doesn't work and ctypes doesn't seem to work with variadic functions including PyUnicode_FromFormat/
---
 Lib/test/test_code.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index b9c4f8bdcb..31cb8876c8 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -396,6 +396,7 @@ def test_bad_index(self):
                               ctypes.c_voidp(100)), 0)
 
         def test_free_called(self):
+            raise unittest.SkipTest("PyCode_SetExtra is broken")
             # Verify that the provided free function gets invoked
             # when the code object is cleaned up.
             f = self.get_func()
@@ -405,6 +406,7 @@ def test_free_called(self):
             self.assertEqual(LAST_FREED, 100)
 
         def test_get_set(self):
+            raise unittest.SkipTest("PyCode_SetExtra is broken")
             # Test basic get/set round tripping.
             f = self.get_func()
 
@@ -421,6 +423,7 @@ def test_get_set(self):
             del f
 
         def test_free_different_thread(self):
+            raise unittest.SkipTest("Requires threading")
             # Freeing a code object on a different thread then
             # where the co_extra was set should be safe.
             f = self.get_func()
@@ -445,8 +448,8 @@ def test_main(verbose=None):
     from test import test_code
     run_doctest(test_code, verbose)
     tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
-    if check_impl_detail(cpython=True) and ctypes is not None:
-        tests.append(CoExtra)
+    # if check_impl_detail(cpython=True) and ctypes is not None:
+    #     tests.append(CoExtra)
     run_unittest(*tests)
 
 if __name__ == "__main__":
-- 
2.25.1


From fcd212640bb74988c31d3ba434bcac83cbcb087c Mon Sep 17 00:00:00 2001
From: Hood <hood@mit.edu>
Date: Thu, 24 Jun 2021 14:55:10 -0700
Subject: [PATCH 08/10] xfail core ctypes tests that don't work

PyCode_SetExtra doesn't work and ctypes doesn't seem to work with variadic functions including PyUnicode_FromFormat/
---
 Lib/test/test_code.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index b9c4f8bdcb..31cb8876c8 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -396,6 +396,7 @@ def test_bad_index(self):
                               ctypes.c_voidp(100)), 0)
 
         def test_free_called(self):
+            raise unittest.SkipTest("PyCode_SetExtra is broken")
             # Verify that the provided free function gets invoked
             # when the code object is cleaned up.
             f = self.get_func()
@@ -405,6 +406,7 @@ def test_free_called(self):
             self.assertEqual(LAST_FREED, 100)
 
         def test_get_set(self):
+            raise unittest.SkipTest("PyCode_SetExtra is broken")
             # Test basic get/set round tripping.
             f = self.get_func()
 
@@ -421,6 +423,7 @@ def test_get_set(self):
             del f
 
         def test_free_different_thread(self):
+            raise unittest.SkipTest("Requires threading")
             # Freeing a code object on a different thread then
             # where the co_extra was set should be safe.
             f = self.get_func()
@@ -445,8 +448,8 @@ def test_main(verbose=None):
     from test import test_code
     run_doctest(test_code, verbose)
     tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
-    if check_impl_detail(cpython=True) and ctypes is not None:
-        tests.append(CoExtra)
+    # if check_impl_detail(cpython=True) and ctypes is not None:
+    #     tests.append(CoExtra)
     run_unittest(*tests)
 
 if __name__ == "__main__":
-- 
2.25.1

