PythonCharmers / python-future

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

WIP Python 3.12 support for removal of imp module #626

Closed odie5533 closed 4 months ago

odie5533 commented 8 months ago

Issue https://github.com/PythonCharmers/python-future/issues/625

Test suite is broken.

src/past/translation/init.py is broken (I only replaced the import statement).

======================================================================================= short test summary info ========================================================================================
FAILED tests/test_future/test_backports.py::TestOrderedDict::test_repr - AssertionError: "OrderedDict({'c': 1, 'b': 2, 'a': 3, 'd': 4, 'e': 5, 'f': 6})" != "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])"
FAILED tests/test_future/test_backports.py::TestOrderedDict::test_repr_recursive - AssertionError: "OrderedDict({'a': None, 'b': None, 'c': None, 'x': ...})" != "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])"
FAILED tests/test_future/test_builtins.py::BuiltinTest::test_compile - SyntaxError: source code string cannot contain null bytes
FAILED tests/test_future/test_builtins.py::BuiltinTest::test_pow - AssertionError: (<class 'TypeError'>, <class 'ValueError'>) not raised by pow
FAILED tests/test_future/test_isinstance.py::TestIsInstanceIsSubclass::test_isinstance_recursion_limit - AssertionError: RuntimeError not raised by blowstack
FAILED tests/test_future/test_isinstance.py::TestIsInstanceIsSubclass::test_subclass_recursion_limit - AssertionError: RuntimeError not raised by blowstack
FAILED tests/test_future/test_standard_library.py::TestStandardLibraryReorganization::test_underscore_prefixed_modules - ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
FAILED tests/test_future/test_standard_library.py::TestFutureMoves::test_future_moves - ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
FAILED tests/test_future/test_urllib2.py::HandlerTests::test_ftp - AssertionError: None != 'image/gif'
FAILED tests/test_future/test_urllib2.py::test_main - future.backports.test.support.TestFailed: Traceback (most recent call last):
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_close - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_fileno - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_getcode - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_geturl - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_info - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_interface - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_iter - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_read - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_readline - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_readlines - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_FileTests::test_relativelocalfile - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::ProxyTests::test_getproxies_environment_keep_no_proxies - AttributeError: module 'future.moves.test.support' has no attribute 'EnvironmentVarGuard'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_URLopener_deprecation - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_empty_socket - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_file_notexists - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_ftp_nohost - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_ftp_nonexisting - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_missing_localfile - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_read_0_9 - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_read_1_0 - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_read_1_1 - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_read_bogus - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_userpass_inurl - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlopen_HttpTests::test_userpass_inurl_w_spaces - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_basic - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_copy - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_reporthook - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_reporthook_0_bytes - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_reporthook_5_bytes - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::urlretrieve_FileTests::test_reporthook_8193_bytes - AttributeError: module 'future.moves.test.support' has no attribute 'TESTFN'
FAILED tests/test_future/test_urllib_toplevel.py::UnquotingTests::test_unquoting - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_urllib_toplevel.py::URLopener_Tests::test_quoted_open - AttributeError: module 'future.moves.test.support' has no attribute 'check_warnings'
FAILED tests/test_future/test_utils.py::TestUtils::test_raise_ - AttributeError: 'TestUtils' object has no attribute 'assertRaisesRegexp'. Did you mean: 'assertRaisesRegex'?
FAILED tests/test_past/test_translation.py::TestTranslate::test_div - AssertionError: 1.5 != 1
FAILED tests/test_past/test_translation.py::TestTranslate::test_exception_syntax - AttributeError: 'NoneType' object has no attribute 'value'
FAILED tests/test_past/test_translation.py::TestTranslate::test_exec_statement - AttributeError: 'NoneType' object has no attribute 'x'
FAILED tests/test_past/test_translation.py::TestTranslate::test_old_builtin_functions - NameError: name 'xrange' is not defined
FAILED tests/test_past/test_translation.py::TestTranslate::test_print_statement - AttributeError: 'NoneType' object has no attribute 'finished'
FAILED tests/test_past/test_translation.py::TestTranslate::test_xrange - NameError: name 'xrange' is not defined
================================================================ 49 failed, 1010 passed, 37 skipped, 46 xfailed, 70 warnings in 23.56s =================================================================
bernhardkaindl commented 8 months ago

@sfdye This is really blocking the use of future in Python 3.12, any plans up update it in Python 3.12? For others users: For now, instead of:

# pylint: disable=wrong-import-position,wrong-import-order
from future import standard_library
standard_library.install_aliases()

We now just use this to have Python2 code working for Python2 and Python3:

try:
    import xmlrpclib
    import SocketServer
    import SimpleXMLRPCServer
except:
    import xmlrpc.client as xmlrpclib
    import socketserver as SocketServer
    import xmlrpc.server as SimpleXMLRPCServer
nsoranzo commented 5 months ago

Issue #625

Test suite is broken.

src/past/translation/__init__.py is broken (I only replaced the import statement).

I have a couple more commits that fix src/past/translation/__init__.py and a bunch of tests at https://github.com/nsoranzo/python-future/tree/python312-imp-module_past , if anyone is interested.