From 6779c8d3440633d8037bee759c45802e574e84a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Sun, 14 Jun 2026 23:56:10 -0400 Subject: [PATCH] Fix some test failures in 3.6 --- .../Cases/CPythonCasesManifest.ini | 11 ++-- .../Cases/IronPythonCasesManifest.ini | 3 + tests/suite/test_datetime_stdlib.py | 37 +++-------- tests/suite/test_heapq_stdlib.py | 35 +++++++++++ tests/suite/test_io_stdlib.py | 2 +- tests/suite/test_regrtest_stdlib.py | 62 +++++++++++++++++++ tests/suite/test_sax_stdlib.py | 13 +++- tests/suite/test_sqlite3_stdlib.py | 5 +- tests/suite/test_ssl_stdlib.py | 2 +- tests/suite/test_yield_from_stdlib.py | 2 +- 10 files changed, 132 insertions(+), 40 deletions(-) create mode 100644 tests/suite/test_heapq_stdlib.py create mode 100644 tests/suite/test_regrtest_stdlib.py diff --git a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini index 5298d6c38..d355219b6 100644 --- a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini @@ -531,9 +531,8 @@ Reason=Only valid for Unix [CPython.test_gzip] IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440 -# TODO: 3.6 -#[CPython.test_heapq] -#Ignore=true +[CPython.test_heapq] # IronPython.test_heapq_stdlib +Ignore=true [CPython.test_httplib] # IronPython.test_httplib_stdlib Ignore=true @@ -833,10 +832,8 @@ RunCondition=$(IS_POSIX) Ignore=true Reason=unittest.case.SkipTest: No module named 'readline' -# TODO: 3.6 -[CPython.test_regrtest] -IsolationLevel=PROCESS -#Ignore=true # lots of failures +[CPython.test_regrtest] # IronPython.test_regrtest_stdlib +Ignore=true [CPython.test_reprlib] Ignore=true diff --git a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini index 57e527834..28f12f138 100644 --- a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini @@ -105,6 +105,9 @@ RetryCount=2 IsolationLevel=PROCESS Arguments=-X:CompilationThreshold 0 "$(TEST_FILE)" # ensure CompilationThreshold is 0 otherwise tests are meaningless! +[IronPython.test_regrtest_stdlib] +IsolationLevel=PROCESS + [IronPython.test_set_stdlib] RunCondition=NOT $(IS_MONO) # weakref failures; https://github.com/IronLanguages/ironpython3/issues/544 IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages/ironpython3/issues/489 diff --git a/tests/suite/test_datetime_stdlib.py b/tests/suite/test_datetime_stdlib.py index a28f48233..831a69d69 100644 --- a/tests/suite/test_datetime_stdlib.py +++ b/tests/suite/test_datetime_stdlib.py @@ -19,7 +19,6 @@ def load_tests(loader, standard_tests, pattern): failing_tests = [ test.datetimetester.TestDate('test_backdoor_resistance'), test.datetimetester.TestDate('test_insane_fromtimestamp'), - test.datetimetester.TestDateTime('test_backdoor_resistance'), test.datetimetester.TestDateTime('test_extreme_timedelta'), test.datetimetester.TestDateTime('test_insane_fromtimestamp'), test.datetimetester.TestDateTime('test_insane_utcfromtimestamp'), @@ -46,6 +45,10 @@ def load_tests(loader, standard_tests, pattern): test.datetimetester.TestTimeTZ('test_zones'), test.datetimetester.TestTimeZone('test_constructor'), ] + if sys.version_info < (3, 6): + failing_tests += [ + test.datetimetester.TestDateTime('test_backdoor_resistance'), + ] if sys.version_info >= (3, 6): failing_tests += [ test.datetimetester.IranTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459 @@ -60,10 +63,12 @@ def load_tests(loader, standard_tests, pattern): test.datetimetester.TestDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given) test.datetimetester.TestDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec' test.datetimetester.TestDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' + test.datetimetester.TestDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime. test.datetimetester.TestDateTimeTZ('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459 test.datetimetester.TestDateTimeTZ('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (2 given) test.datetimetester.TestDateTimeTZ('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec' test.datetimetester.TestDateTimeTZ('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' + test.datetimetester.TestDateTimeTZ('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime. test.datetimetester.TestLocalTimeDisambiguation('test_comparison'), # https://github.com/IronLanguages/ironpython3/issues/1459 test.datetimetester.TestLocalTimeDisambiguation('test_constructors'), # https://github.com/IronLanguages/ironpython3/issues/1459 test.datetimetester.TestLocalTimeDisambiguation('test_dst'), # https://github.com/IronLanguages/ironpython3/issues/1459 @@ -82,35 +87,11 @@ def load_tests(loader, standard_tests, pattern): test.datetimetester.TestLocalTimeDisambiguation('test_vilnius_1941_toutc'), # AssertionError: '06/23/41 19:59:59 ' != 'Mon Jun 23 19:59:59 1941 UTC' test.datetimetester.TestModule('test_divide_and_round'), # AttributeError: 'module' object has no attribute '_divide_and_round' test.datetimetester.TestSubclassDateTime('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestSubclassDateTime('test_combine'), # TypeError: combine() takes exactly 2 arguments (3 given) + test.datetimetester.TestSubclassDateTime('test_compat_unpickle'), # TypeError: function takes at least 3 arguments (1 given) test.datetimetester.TestSubclassDateTime('test_isoformat'), # TypeError: isoformat() got an unexpected keyword argument 'timespec' test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' - test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes" - test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str - test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given) - test.datetimetester.TestTime('test_subclass_replace'), # AssertionError: is not - test.datetimetester.TestTimeDelta('test_issue31293'), # ZeroDivisionError: Attempted to divide by zero. - test.datetimetester.TestTimeTZ('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes" - test.datetimetester.TestTimeTZ('test_compat_unpickle'), # TypeError: expected Int32, got str - test.datetimetester.TestTimeTZ('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given) - test.datetimetester.TestTimeTZ('test_subclass_replace'), # AssertionError: is not - test.datetimetester.ZoneInfoTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459 - test.datetimetester.ZoneInfoTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459 - test.datetimetester.ZoneInfoTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset' - test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' - test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes" - test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str - test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given) - test.datetimetester.TestTime('test_subclass_replace'), # AssertionError: is not - test.datetimetester.TestTimeDelta('test_computations'), # rounding differences - test.datetimetester.TestTimeDelta('test_issue31293'), # ZeroDivisionError: Attempted to divide by zero. - test.datetimetester.TestTimeTZ('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes" - test.datetimetester.TestTimeTZ('test_compat_unpickle'), # TypeError: expected Int32, got str - test.datetimetester.TestTimeTZ('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given) - test.datetimetester.TestTimeTZ('test_subclass_replace'), # AssertionError: is not - test.datetimetester.ZoneInfoTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459 - test.datetimetester.ZoneInfoTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459 - test.datetimetester.ZoneInfoTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset' - test.datetimetester.TestSubclassDateTime('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' + test.datetimetester.TestSubclassDateTime('test_timestamp_limits'), # ValueError: The added or subtracted value results in an un-representable DateTime. test.datetimetester.TestTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "expected Int32, got bytes" test.datetimetester.TestTime('test_compat_unpickle'), # TypeError: expected Int32, got str test.datetimetester.TestTime('test_isoformat'), # TypeError: isoformat() takes no arguments (1 given) diff --git a/tests/suite/test_heapq_stdlib.py b/tests/suite/test_heapq_stdlib.py new file mode 100644 index 000000000..3130cc532 --- /dev/null +++ b/tests/suite/test_heapq_stdlib.py @@ -0,0 +1,35 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the Apache 2.0 License. +# See the LICENSE file in the project root for more information. + +## +## Run selected tests from test_heapq from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_heapq + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_heapq, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_heapq.TestErrorHandlingC('test_comparison_operator_modifiying_heap'), # TypeError: '<' not supported between instances of 'EvilClass' and 'int' + test.test_heapq.TestErrorHandlingC('test_comparison_operator_modifiying_heap_two_heaps'), # AssertionError: (, ) not raised by heappush + test.test_heapq.TestErrorHandlingPython('test_comparison_operator_modifiying_heap'), # TypeError: '<' not supported between instances of 'EvilClass' and 'int' + test.test_heapq.TestModules('test_c_functions'), # AssertionError: 'heapq' != '_heapq' + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_io_stdlib.py b/tests/suite/test_io_stdlib.py index 87c01b413..5b8c4f5ba 100644 --- a/tests/suite/test_io_stdlib.py +++ b/tests/suite/test_io_stdlib.py @@ -83,7 +83,6 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CMiscIOTest('test_readinto_buffer_overflow'), # IndexError: Index was outside the bounds of the array. test.test_io.CMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered test.test_io.CMiscIOTest('test_warn_on_dealloc_fd'), # AssertionError: ResourceWarning not triggered - test.test_io.PyMiscIOTest('test_io_after_close'), # AttributeError: 'FileIO' object has no attribute 'read1' test.test_io.PyMiscIOTest('test_nonblock_pipe_write_bigbuf'), # AttributeError: 'module' object has no attribute 'fcntl' test.test_io.PyMiscIOTest('test_nonblock_pipe_write_smallbuf'), # AttributeError: 'module' object has no attribute 'fcntl' test.test_io.PyMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered @@ -102,6 +101,7 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CBufferedWriterTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CBufferedRandomTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CTextIOWrapperTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.PyMiscIOTest('test_io_after_close'), # AttributeError: 'FileIO' object has no attribute 'read1' test.test_io.PyMiscIOTest('test_pickling'), # AssertionError: TypeError not raised by _dumps ] if sys.version_info >= (3, 6): diff --git a/tests/suite/test_regrtest_stdlib.py b/tests/suite/test_regrtest_stdlib.py new file mode 100644 index 000000000..ea43de78e --- /dev/null +++ b/tests/suite/test_regrtest_stdlib.py @@ -0,0 +1,62 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the Apache 2.0 License. +# See the LICENSE file in the project root for more information. + +## +## Run selected tests from test_regrtest from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_regrtest + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_regrtest, pattern=pattern) + + if is_ironpython: + failing_tests = [] + + skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + # TODO: these all fail (and are slow) + test.test_regrtest.ArgsTestCase('test_coverage'), + test.test_regrtest.ArgsTestCase('test_crashed'), + test.test_regrtest.ArgsTestCase('test_env_changed'), + test.test_regrtest.ArgsTestCase('test_failing_test'), + test.test_regrtest.ArgsTestCase('test_forever'), + test.test_regrtest.ArgsTestCase('test_fromfile'), + test.test_regrtest.ArgsTestCase('test_huntrleaks'), + test.test_regrtest.ArgsTestCase('test_huntrleaks_fd_leak'), + test.test_regrtest.ArgsTestCase('test_interrupted'), + test.test_regrtest.ArgsTestCase('test_list_cases'), + test.test_regrtest.ArgsTestCase('test_list_tests'), + test.test_regrtest.ArgsTestCase('test_matchfile'), + test.test_regrtest.ArgsTestCase('test_no_test_ran_some_test_exist_some_not'), + test.test_regrtest.ArgsTestCase('test_no_tests_ran'), + test.test_regrtest.ArgsTestCase('test_no_tests_ran_multiple_tests_nonexistent'), + test.test_regrtest.ArgsTestCase('test_random'), + test.test_regrtest.ArgsTestCase('test_rerun_fail'), + test.test_regrtest.ArgsTestCase('test_resources'), + test.test_regrtest.ArgsTestCase('test_slow_interrupted'), + test.test_regrtest.ArgsTestCase('test_slowest'), + test.test_regrtest.ArgsTestCase('test_wait'), + test.test_regrtest.ProgramsTestCase('test_module_autotest'), + test.test_regrtest.ProgramsTestCase('test_module_from_test_autotest'), + test.test_regrtest.ProgramsTestCase('test_module_regrtest'), + test.test_regrtest.ProgramsTestCase('test_module_test'), + test.test_regrtest.ProgramsTestCase('test_pcbuild_rt'), + test.test_regrtest.ProgramsTestCase('test_script_autotest'), + test.test_regrtest.ProgramsTestCase('test_script_regrtest'), + test.test_regrtest.ProgramsTestCase('test_tools_buildbot_test'), + test.test_regrtest.ProgramsTestCase('test_tools_script_run_tests'), + ] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_sax_stdlib.py b/tests/suite/test_sax_stdlib.py index e0d059fbf..c82474115 100644 --- a/tests/suite/test_sax_stdlib.py +++ b/tests/suite/test_sax_stdlib.py @@ -22,7 +22,6 @@ def load_tests(loader, standard_tests, pattern): test.test_sax.ErrorReportingTest('test_expat_incomplete'), # AttributeError: 'xmlparser' object has no attribute 'ErrorColumnNumber' test.test_sax.ErrorReportingTest('test_expat_inpsource_location'), # AttributeError: 'xmlparser' object has no attribute 'ErrorColumnNumber' test.test_sax.ExpatReaderTest('test_expat_dtdhandler'), # AssertionError - test.test_sax.ExpatReaderTest('test_expat_entityresolver'), # AssertionError test.test_sax.ExpatReaderTest('test_expat_text_file'), # AssertionError test.test_sax.ParseTest('test_parseString_bytes'), # UnicodeEncodeError test.test_sax.ParseTest('test_parse_InputSource'), # AttributeError: 'xmlparser' object has no attribute 'ErrorColumnNumber' @@ -53,6 +52,18 @@ def load_tests(loader, standard_tests, pattern): test.test_sax.WriterXmlgenTest('test_xmlgen_pi'), # TypeError: expected long, got NoneType test.test_sax.WriterXmlgenTest('test_xmlgen_unencodable'), # TypeError: expected long, got NoneType ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_sax.ExpatReaderTest('test_expat_entityresolver'), # AssertionError + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_sax.ExpatReaderTest('test_expat_entityresolver_enabled'), # AssertionError + test.test_sax.ExpatReaderTest('test_expat_external_dtd_enabled'), # AssertionError + test.test_sax.ExpatReaderTest('test_expat_inpsource_character_stream'), # AssertionError + test.test_sax.ParseTest('test_parseString_text'), # UnicodeEncodeError + test.test_sax.ParseTest('test_parse_close_source'), # AttributeError: 'xmlparser' object has no attribute 'ErrorColumnNumber' + ] skip_tests = [] diff --git a/tests/suite/test_sqlite3_stdlib.py b/tests/suite/test_sqlite3_stdlib.py index ae70a2671..3680f9175 100644 --- a/tests/suite/test_sqlite3_stdlib.py +++ b/tests/suite/test_sqlite3_stdlib.py @@ -116,7 +116,6 @@ def load_tests(loader, standard_tests, pattern): sqlite3.test.transactions.TransactionTests('CheckDMLDoesNotAutoCommitBefore'), sqlite3.test.transactions.TransactionalDDL('CheckImmediateTransactionalDDL'), sqlite3.test.transactions.TransactionalDDL('CheckTransactionalDDL'), - sqlite3.test.userfunctions.AggregateTests('CheckAggrCheckParamsInt'), ] if is_linux: failing_tests += [ @@ -148,6 +147,10 @@ def load_tests(loader, standard_tests, pattern): sqlite3.test.userfunctions.AuthorizerLargeIntegerTests('test_column_access'), sqlite3.test.userfunctions.AuthorizerLargeIntegerTests('test_table_access'), ] + if sys.version_info >= (3, 6): + skip_tests += [ + sqlite3.test.userfunctions.AggregateTests('CheckAggrCheckParamsInt'), + ] return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_ssl_stdlib.py b/tests/suite/test_ssl_stdlib.py index 1cc64beb6..317007d04 100644 --- a/tests/suite/test_ssl_stdlib.py +++ b/tests/suite/test_ssl_stdlib.py @@ -18,7 +18,6 @@ def load_tests(loader, standard_tests, pattern): if is_ironpython: failing_tests = [ test.test_ssl.BasicSocketTests('test_enum_crls'), # AssertionError: [] is not true - test.test_ssl.BasicSocketTests('test_errors'), # AssertionError: OSError not raised test.test_ssl.BasicSocketTests('test_get_default_verify_paths'), # AttributeError: 'module' object has no attribute 'get_default_verify_paths' test.test_ssl.BasicSocketTests('test_parse_cert'), # KeyError: OCSP test.test_ssl.BasicSocketTests('test_parse_cert_CVE_2013_4238'), # AssertionError: Tuples differ @@ -47,6 +46,7 @@ def load_tests(loader, standard_tests, pattern): ] if sys.version_info < (3, 6): failing_tests += [ + test.test_ssl.BasicSocketTests('test_errors'), # AssertionError: OSError not raised test.test_ssl.NetworkedTests('test_ciphers'), # AssertionError: SSLError not raised test.test_ssl.NetworkedTests('test_connect'), # AssertionError: {} != None test.test_ssl.NetworkedTests('test_connect_capath'), # ssl.SSLError: [Errno 'errors while validating certificate chain: '] RemoteCertificateChainErrors diff --git a/tests/suite/test_yield_from_stdlib.py b/tests/suite/test_yield_from_stdlib.py index 7022f3a7c..37138adaf 100644 --- a/tests/suite/test_yield_from_stdlib.py +++ b/tests/suite/test_yield_from_stdlib.py @@ -11,7 +11,7 @@ from iptest import is_ironpython, generate_suite, run_test if sys.version_info >= (3, 6): - import test.yield_from as test_yield_from + import test.test_yield_from as test_yield_from else: import test.test_pep380 as test_yield_from