File adjust_test_sgmllib.patch of Package python-sgmllib3k

---
 test_sgmllib.py |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

--- a/test_sgmllib.py
+++ b/test_sgmllib.py
@@ -1,8 +1,9 @@
+import io
 import pprint
 import re
 import unittest
-from test import test_support
-sgmllib = test_support.import_module('sgmllib', deprecated=True)
+import sgmllib
+import sys
 
 
 class EventCollector(sgmllib.SGMLParser):
@@ -308,6 +309,8 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.
             ("starttag", "a", []),
             ])
 
+    @unittest.skipIf(sys.version_info[:2] >= (3, 10),
+                     "_markupbase is stricter in 3.10")
     def test_declaration_junk_chars(self):
         self.check_parse_error("<!DOCTYPE foo $ >")
 
@@ -357,13 +360,13 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.
         # Just verify this code doesn't cause a hang.
         CHUNK = 1024  # increasing this to 8212 makes the problem go away
 
-        f = open(test_support.findfile('sgml_input.html'))
-        fp = sgmllib.SGMLParser()
-        while 1:
-            data = f.read(CHUNK)
-            fp.feed(data)
-            if len(data) != CHUNK:
-                break
+        with io.open('sgml_input.html', 'r', encoding="latin1") as f:
+            fp = sgmllib.SGMLParser()
+            while 1:
+                data = f.read(CHUNK)
+                fp.feed(data)
+                if len(data) != CHUNK:
+                    break
 
     def test_only_decode_ascii(self):
         # SF bug #1651995, make sure non-ascii character references are not decoded
@@ -432,7 +435,7 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.
 
 
 def test_main():
-    test_support.run_unittest(SGMLParserTestCase)
+    unittest.TextTestRunner(verbosity=2).run(suite(SGMLParserTestCase))
 
 
 if __name__ == "__main__":
openSUSE Build Service is sponsored by