From b6ba59657c8c7e169e8eeb763d85ca6136df3eea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 29 Mar 2024 16:22:00 +0100
Subject: [PATCH] skip tests that are broken on pypy

---
 src/lxml/tests/test_http_io.py   |  3 ++-
 src/lxml/tests/test_nsclasses.py |  3 ++-
 src/lxml/tests/test_objectify.py | 37 ++++++++++++++++++++++++++++++--
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/lxml/tests/test_http_io.py b/src/lxml/tests/test_http_io.py
index 8385e393..0b259299 100644
--- a/src/lxml/tests/test_http_io.py
+++ b/src/lxml/tests/test_http_io.py
@@ -10,3 +10,3 @@ import gzip
 
-from .common_imports import etree, HelperTestCase, BytesIO, _bytes
+from .common_imports import etree, HelperTestCase, BytesIO, _bytes, IS_PYPY
 from .dummy_http_server import webserver, HTTPRequestCollector
@@ -14,2 +14,3 @@ from .dummy_http_server import webserver, HTTPRequestCollector
 
+@unittest.skipIf(IS_PYPY, "broken on pypy")
 class HttpIOTestCase(HelperTestCase):
diff --git a/src/lxml/tests/test_nsclasses.py b/src/lxml/tests/test_nsclasses.py
index 0c33f20c..08540001 100644
--- a/src/lxml/tests/test_nsclasses.py
+++ b/src/lxml/tests/test_nsclasses.py
@@ -8,3 +8,3 @@ import unittest
 
-from .common_imports import etree, HelperTestCase, _bytes, make_doctest
+from .common_imports import etree, HelperTestCase, _bytes, make_doctest, IS_PYPY
 
@@ -45,2 +45,3 @@ class ETreeNamespaceClassesTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_ns_classes(self):
diff --git a/src/lxml/tests/test_objectify.py b/src/lxml/tests/test_objectify.py
index 39fe0098..92c857f8 100644
--- a/src/lxml/tests/test_objectify.py
+++ b/src/lxml/tests/test_objectify.py
@@ -10,3 +10,4 @@ import unittest
 from .common_imports import (
-    etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO
+    etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO,
+    IS_PYPY
 )
@@ -383,2 +384,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_setattr(self):
@@ -818,2 +820,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_build_tree(self):
@@ -847,2 +850,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_bool(self):
@@ -884,2 +888,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str(self):
@@ -891,2 +896,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str_intliteral(self):
@@ -898,2 +904,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str_floatliteral(self):
@@ -905,2 +912,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str_mul(self):
@@ -917,2 +925,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str_add(self):
@@ -992,2 +1001,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_ustr(self):
@@ -999,2 +1009,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_ustr_intliteral(self):
@@ -1006,2 +1017,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_ustr_floatliteral(self):
@@ -1013,2 +1025,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_ustr_mul(self):
@@ -1025,2 +1038,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_ustr_add(self):
@@ -1050,2 +1064,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_int(self):
@@ -1066,2 +1081,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_float(self):
@@ -1082,2 +1098,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_float_precision(self):
@@ -1101,2 +1118,3 @@ class ObjectifyTestCase(HelperTestCase):
   
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_float_precision_consistency(self):
@@ -1187,2 +1205,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_unregistered(self):
@@ -1349,2 +1368,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_str_cmp(self):
@@ -1376,2 +1396,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_int_cmp(self):
@@ -1398,2 +1419,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_type_bool_cmp(self):
@@ -2067,2 +2089,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_registered_type_stringify(self):
@@ -2537,2 +2560,3 @@ class ObjectifyTestCase(HelperTestCase):
     # type-looked-up as ObjectifiedElement (no annotations)
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_int(self):
@@ -2542,2 +2566,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_float(self):
@@ -2547,2 +2572,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_str(self):
@@ -2552,2 +2578,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_unicode(self):
@@ -2557,2 +2584,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_bool(self):
@@ -2562,2 +2590,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_none(self):
@@ -2567,2 +2596,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_value_concatenation(self):
@@ -2577,2 +2607,3 @@ class ObjectifyTestCase(HelperTestCase):
 
+    @unittest.skipIf(IS_PYPY, "broken on pypy")
     def test_efactory_nested(self):
@@ -2745,3 +2776,5 @@ def test_suite():
     suite.addTests(doctest.DocTestSuite(objectify))
-    suite.addTests([make_doctest('objectify.txt')])
+    if not IS_PYPY:
+        suite.addTests([make_doctest('objectify.txt')])
+        suite.addTests([make_doctest('../../../doc/objectify.txt')])
     return suite
-- 
2.46.0