PythonCharmers / python-future

Easy, clean, reliable Python 2/3 compatibility
http://python-future.org
MIT License
1.17k stars 291 forks source link

test_single_exception_stacktrace failed with python-3.11 #608

Open sagitter opened 1 year ago

sagitter commented 1 year ago

Hi all.

test_single_exception_stacktrace is failing with Python-3.11.0~b5:

+ PYTHONPATH=/builddir/build/BUILD/future-0.18.2/python3/build/lib
+ py.test-3.11 -k 'not test_pow and not test_urllib2' -q
...............................................................s........ [  6%]
...s....................sss..............s.............................. [ 13%]
..s..................x........s......................................... [ 20%]
..................s...x...x..x..x.......s.xsss.x....x...x.....x.....x.xx [ 26%]
............................................ss.......................... [ 33%]
........................................................................ [ 40%]
..s..........................................x.........sssss............ [ 47%]
.............................................................s.s........ [ 53%]
...........x...x...xx........................ss..........s....ss........ [ 60%]
.....s.....ss....................s............................s..x...... [ 67%]
........................................................................ [ 73%]
...........s..................................s.....s..s................ [ 80%]
....................s.s..............s.sssssssssss...................... [ 87%]
..............................F....x..xxxxxx...x.xxxxxx....xx..xx..x.xx. [ 94%]
xx...x....x...x.......................s....................x....         [100%]
=================================== FAILURES ===================================
__________________ TestCause.test_single_exception_stacktrace __________________
self = <test_future.test_utils.TestCause testMethod=test_single_exception_stacktrace>
        def test_single_exception_stacktrace(self):
            expected = '''Traceback (most recent call last):
      File "/opt/python-future/tests/test_future/test_utils.py", line 328, in test_single_exception_stacktrace
        raise CustomException('ERROR')
    '''
            if sys.version_info >= (3, 11):
                expected += '    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
            if PY2:
                expected += 'CustomException: ERROR\n'
            else:
                expected += 'test_future.test_utils.CustomException: ERROR\n'

            try:
>               raise CustomException('ERROR')
E               test_future.test_utils.CustomException: ERROR
tests/test_future/test_utils.py:354: CustomException
During handling of the above exception, another exception occurred:
self = <test_future.test_utils.TestCause testMethod=test_single_exception_stacktrace>
        def test_single_exception_stacktrace(self):
            expected = '''Traceback (most recent call last):
      File "/opt/python-future/tests/test_future/test_utils.py", line 328, in test_single_exception_stacktrace
        raise CustomException('ERROR')
    '''
            if sys.version_info >= (3, 11):
                expected += '    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
            if PY2:
                expected += 'CustomException: ERROR\n'
            else:
                expected += 'test_future.test_utils.CustomException: ERROR\n'

            try:
                raise CustomException('ERROR')
            except:
                ret = re.sub(r'"[^"]*tests/test_future', '"/opt/python-future/tests/test_future', traceback.format_exc())
                ret = re.sub(r', line \d+,', ', line 328,', ret)
>               self.assertEqual(expected, ret)
E               AssertionError: 'Trac[173 chars]\')\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ntest_[38 chars]OR\n' != 'Trac[173 chars]\')\ntest_future.test_utils.CustomException: ERROR\n'
E                 Traceback (most recent call last):
E                   File "/opt/python-future/tests/test_future/test_utils.py", line 328, in test_single_exception_stacktrace
E                     raise CustomException('ERROR')
E               -     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E                 test_future.test_utils.CustomException: ERROR
tests/test_future/test_utils.py:358: AssertionError
=============================== warnings summary ===============================
build/lib/future/standard_library/__init__.py:65
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/standard_library/__init__.py:65: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    import imp
tests/test_future/test_builtins.py:267
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_builtins.py:267: DeprecationWarning: invalid escape sequence '\u'
    (str(b'\u0663\u0661\u0664 ','raw-unicode-escape'), 314),
tests/test_future/test_builtins.py:289
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_builtins.py:289: DeprecationWarning: invalid escape sequence '\u'
    (str(b'\u0663\u0661\u0664 ','raw-unicode-escape'), 314),
build/lib/future/backports/test/support.py:1977
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/test/support.py:1977: DeprecationWarning: invalid escape sequence '\d'
    m = re.match("2.6.(\d{1,2})", kernel_version)
build/lib/future/backports/email/message.py:13
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/email/message.py:13: DeprecationWarning: 'uu' is deprecated and slated for removal in Python 3.13
    import uu
build/lib/future/backports/email/utils.py:68
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/email/utils.py:68: DeprecationWarning: invalid escape sequence '\A'
    '([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)').search
build/lib/future/backports/urllib/parse.py:957
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/urllib/parse.py:957: DeprecationWarning: invalid escape sequence '\?'
    _queryprog = re.compile('^(.*)\?([^?]*)$')
build/lib/libfuturize/fixer_util.py:11
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/libfuturize/fixer_util.py:11: DeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
    from lib2to3.fixer_util import (FromImport, Newline, is_import,
tests/test_future/test_htmlparser.py:685
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_htmlparser.py:685: DeprecationWarning: invalid escape sequence '\='
    "<a $><b $=%><c \=/>",
build/lib/future/backports/html/parser.py:31
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/html/parser.py:31: DeprecationWarning: invalid escape sequence '\s'
    tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')
build/lib/future/backports/html/parser.py:79
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/html/parser.py:79: DeprecationWarning: invalid escape sequence '\s'
    endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
tests/test_future/test_http_cookiejar.py:1034
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_http_cookiejar.py:1034: DeprecationWarning: invalid escape sequence '\$'
    self.assertRegex(h, "\$Port([^=]|$)",
tests/test_future/test_http_cookiejar.py:1373
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_http_cookiejar.py:1373: DeprecationWarning: invalid escape sequence '\s'
    '\s*\$Path="\/acme"')
tests/test_future/test_http_cookiejar.py:1375
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_http_cookiejar.py:1375: DeprecationWarning: invalid escape sequence '\s'
    '\s*\$Path="\/acme"')
build/lib/future/backports/http/client.py:1
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/http/client.py:1: DeprecationWarning: invalid escape sequence '\_'
    """HTTP/1.1 client library
build/lib/future/backports/email/feedparser.py:37
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/email/feedparser.py:37: DeprecationWarning: invalid escape sequence '\Z'
    NLCRE_eol = re.compile('(\r\n|\r|\n)\Z')
build/lib/future/backports/http/cookiejar.py:212
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/http/cookiejar.py:212: DeprecationWarning: invalid escape sequence '\d'
    "(\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$", re.ASCII)
build/lib/future/backports/http/cookiejar.py:289
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/http/cookiejar.py:289: DeprecationWarning: invalid escape sequence '\d'
    """^
build/lib/future/backports/http/cookiejar.py:423
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/http/cookiejar.py:423: DeprecationWarning: invalid escape sequence '\s'
    non_junk, nr_junk_chars = re.subn("^[=\s;]*", "", text)
tests/test_future/test_urllib.py:536
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_urllib.py:536: DeprecationWarning: invalid escape sequence '\^'
    """Tests for urllib.quote() and urllib.quote_plus()
tests/test_future/test_urllib.py:611
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_urllib.py:611: DeprecationWarning: invalid escape sequence '\^'
    should_quote.append('<>#%"{}|\^[]`')
tests/test_future/test_urllib_toplevel.py:551
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_urllib_toplevel.py:551: DeprecationWarning: invalid escape sequence '\^'
    """Tests for urllib.quote() and urllib.quote_plus()
tests/test_future/test_urllib_toplevel.py:626
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_urllib_toplevel.py:626: DeprecationWarning: invalid escape sequence '\^'
    should_quote.append('<>#%"{}|\^[]`')
build/lib/past/types/oldstr.py:23
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/past/types/oldstr.py:23: DeprecationWarning: invalid escape sequence '\d'
    """
tests/test_future/test_htmlparser.py: 4 warnings
tests/test_future/test_http_cookiejar.py: 5 warnings
tests/test_future/test_urllibnet.py: 3 warnings
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/test/support.py:1656: DeprecationWarning: unittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.
    suite.addTest(unittest.makeSuite(cls))
tests/test_future/test_httplib.py::SourceAddressTest::testHTTPSConnectionSourceAddress
tests/test_future/test_httplib.py::HTTPSTest::test_attributes
tests/test_future/test_httplib.py::HTTPSTest::test_host_port
tests/test_future/test_httplib.py::HTTPSTest::test_host_port
tests/test_future/test_httplib.py::HTTPSTest::test_host_port
tests/test_future/test_httplib.py::HTTPSTest::test_host_port
tests/test_future/test_httplib.py::HTTPSTest::test_host_port
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/future/backports/http/client.py:1218: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
    context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_int.py:401: DeprecationWarning: The delegation of int() to __trunc__ is deprecated.
    int(TruncReturnsNonIntegral())
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
tests/test_future/test_int.py::IntTestCases::test_intconversion
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_int.py:421: DeprecationWarning: The delegation of int() to __trunc__ is deprecated.
    int(TruncReturnsBadInt())
tests/test_future/test_standard_library.py::TestStandardLibraryReorganization::test_reload
  /usr/lib64/python3.11/importlib/__init__.py:169: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
    _bootstrap._exec(spec, module)
tests/test_future/test_urllibnet.py::urlopenNetworkTests::test_getcode
tests/test_future/test_urllibnet.py::test_main
  /builddir/build/BUILD/future-0.18.2/python3/tests/test_future/test_urllibnet.py:103: DeprecationWarning: FancyURLopener style of invoking requests is deprecated. Use newer urlopen functions/methods
    open_url = urllib_request.FancyURLopener().open(URL)
tests/test_past/test_oldstr.py::TestOldStr::test_unescape
  /builddir/build/BUILD/future-0.18.2/python3/build/lib/past/types/oldstr.py:37: DeprecationWarning: invalid escape sequence '\c'
    return s.encode().decode('unicode_escape')
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_future/test_utils.py::TestCause::test_single_exception_stacktrace
1 failed, 973 passed, 52 skipped, 57 deselected, 46 xfailed, 55 warnings in 26.95s