diff --git a/make.ps1 b/make.ps1 index e02bb09db..2075ca48d 100755 --- a/make.ps1 +++ b/make.ps1 @@ -244,18 +244,6 @@ function Purge() { } switch -wildcard ($target) { - # debug targets - "restore-debug" { Main "RestoreReferences" "Debug" } - "debug" { Main "Build" "Debug" } - "clean-debug" { Main "Clean" "Debug" } - "stage-debug" { Main "Stage" "Debug" } - "package-debug" { Main "Package" "Debug" } - "test-debug-*" { Test $target.Substring(11) "Debug" $frameworks $platform; break } - "test-debug" { Test "all" "Debug" $frameworks $platform; break } - - # release targets - "release" { Main "Build" "Release" } - # general targets "restore" { Main "RestoreReferences" $configuration } "build" { Main "Build" $configuration } diff --git a/src/core/IronPython.Modules/signal.cs b/src/core/IronPython.Modules/_signal.cs similarity index 99% rename from src/core/IronPython.Modules/signal.cs rename to src/core/IronPython.Modules/_signal.cs index 4369e034b..089b7b25e 100644 --- a/src/core/IronPython.Modules/signal.cs +++ b/src/core/IronPython.Modules/_signal.cs @@ -23,7 +23,11 @@ #if FEATURE_PROCESS +#if PYTHON_34 // rename to _signal in 3.5 [assembly: PythonModule("signal", typeof(IronPython.Modules.PythonSignal))] +#else +[assembly: PythonModule("_signal", typeof(IronPython.Modules.PythonSignal))] +#endif namespace IronPython.Modules { public static partial class PythonSignal { public const string __doc__ = """ diff --git a/src/core/IronPython.StdLib/lib/unittest/loader.py b/src/core/IronPython.StdLib/lib/unittest/loader.py index af39216d2..792d17fc5 100644 --- a/src/core/IronPython.StdLib/lib/unittest/loader.py +++ b/src/core/IronPython.StdLib/lib/unittest/loader.py @@ -81,7 +81,7 @@ def loadTestsFromTestCase(self, testCaseClass): loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) return loaded_suite - def loadTestsFromModule(self, module, use_load_tests=True): + def loadTestsFromModule(self, module, use_load_tests=True, **kws): # ironpython: add kws to accept pattern for load_tests """Return a suite of all tests cases contained in the given module""" tests = [] for name in dir(module): diff --git a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini index 181e557ee..5298d6c38 100644 --- a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini @@ -7,6 +7,9 @@ Timeout=120000 # 2 minute timeout [CPython.ctypes.test_as_parameter] Ignore=true +[CPython.ctypes.test_cast] +RunCondition=NOT $(IS_POSIX) # https://github.com/IronLanguages/ironpython3/issues/1455 + [CPython.ctypes.test_errno] Ignore=true Reason=Current implementation of get_last_error needs to be debugged @@ -54,6 +57,9 @@ Ignore=true [CPython.ctypes.test_slicing] Ignore=true # https://github.com/IronLanguages/ironpython3/issues/1299 +[CPython.ctypes.test_structures] # IronPython.test_structures_ctypes_stdlib +Ignore=true + [CPython.ctypes.test_unicode] Ignore=true Reason=https://github.com/IronLanguages/ironpython2/issues/405 @@ -82,9 +88,15 @@ Ignore=true [CPython.distutils.test_file_util] Ignore=true +[CPython.distutils.test_filelist] +NotParallelSafe=true + [CPython.distutils.test_install_lib] Ignore=true +[CPython.distutils.test_msvccompiler] # new in 3.5 +Ignore=true + [CPython.distutils.test_sdist] Ignore=true @@ -102,16 +114,26 @@ Ignore=true RunCondition=$(IS_OSX) Ignore=true +[CPython.test_abc] # IronPython.test_abc_stdlib +Ignore=true + [CPython.test_aifc] # Module has been removed in 3.13 - https://github.com/IronLanguages/ironpython3/issues/1352 Ignore=true Reason=ImportError: No module named audioop -[CPython.test_array] -IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489 +[CPython.test_array] # IronPython.test_array_stdlib +Ignore=true + +[CPython.test_asdl_parser] # new in 3.5 +Ignore=true +Reason=unittest.case.SkipTest: test irrelevant for an installed Python [CPython.test_ast] Ignore=true +[CPython.test_asyncgen] # new in 3.6 - https://github.com/IronLanguages/ironpython3/issues/107 +Ignore=true + [CPython.test_asynchat] # Module has been removed in 3.12 - https://github.com/IronLanguages/ironpython3/issues/1352 RunCondition=NOT $(IS_OSX) # TODO: debug @@ -127,6 +149,9 @@ Ignore=true [CPython.test_asyncio.test_locks] Ignore=true +[CPython.test_asyncio.test_pep492] # https://github.com/IronLanguages/ironpython3/issues/98 +Ignore=true + [CPython.test_asyncio.test_sslproto] Ignore=true @@ -158,6 +183,12 @@ Ignore=true Ignore=true Reason=ImportError: No module named audioop +[CPython.test_base64] +IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440 + +[CPython.test_bdb] # new in 3.6 +Ignore=true + [CPython.test_bigmem] Ignore=true @@ -181,6 +212,9 @@ Ignore=true RunCondition=$(IS_DEBUG) # https://github.com/IronLanguages/ironpython3/issues/1067 Timeout=600000 # 10 minute timeout +[CPython.test_call] # IronPython.test_call_stdlib +Ignore=true + [CPython.test_capi] Ignore=true Reason=ImportError: No module named _testcapi @@ -209,6 +243,9 @@ Ignore=true [CPython.test_code] Ignore=true +[CPython.test_code_module] # IronPython.test_code_module_stdlib +Ignore=true + [CPython.test_codeccallbacks] # IronPython.test_codeccallbacks_stdlib Ignore=true @@ -286,6 +323,9 @@ IsolationLevel=ENGINE MaxRecursion=100 Ignore=true +[CPython.test_coroutines] # new in 3.5 +Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/98 + [CPython.test_cprofile] Ignore=true Reason=ImportError: No module named _lsprof @@ -322,7 +362,7 @@ Ignore=true [CPython.test_deque] IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489 -RetryCount=2 +RunCondition=NOT $(IS_MONO) # https://github.com/IronLanguages/ironpython3/issues/544 [CPython.test_descr] # IronPython.test_descr_stdlib IsolationLevel=ENGINE @@ -337,6 +377,9 @@ Reason=unittest.case.SkipTest: test works only on Solaris OS family [CPython.test_dict] # IronPython.test_dict_stdlib Ignore=true +[CPython.test_dict_version] # new in 3.6 +Ignore=true + [CPython.test_dictviews] IsolationLevel=ENGINE MaxRecursion=100 @@ -360,6 +403,9 @@ Ignore=true Ignore=true Reason=StackOverflowException +[CPython.test_dtrace] # new in 3.6 +Ignore=true + [CPython.test_dynamic] IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/489 @@ -392,6 +438,9 @@ Ignore=true Ignore=true Reason=unittest.case.SkipTest: test works only on Linux 2.6 +[CPython.test_exception_hierarchy] # used to be test_pep3151 (renamed in 3.6) +Ignore=true + [CPython.test_exceptions] Ignore=true Reason=StackOverflowException @@ -411,6 +460,9 @@ RunCondition=NOT $(IS_POSIX) # TODO: debug [CPython.test_filecmp] NotParallelSafe=true # Creates/deletes a directory with a static name 'dir' in $TEMP +[CPython.test_fileinput] # IronPython.test_fileinput_stdlib +Ignore=true + [CPython.test_fileio] Ignore=true @@ -469,6 +521,20 @@ NotParallelSafe=true # Creates/deletes a directory with static name 'xx' [CPython.test_glob] RunCondition=NOT $(IS_POSIX) # TODO: figure out +[CPython.test_grammar] # IronPython.test_grammar_stdlib +Ignore=true + +[CPython.test_grp] +RunCondition=$(IS_POSIX) +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_httplib] # IronPython.test_httplib_stdlib Ignore=true Reason=Blocking @@ -479,7 +545,7 @@ Reason=Blocking # works? [CPython.test_idle] Ignore=true -Reason=ImportError: No module named '_tkinter' +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_imaplib] Ignore=true @@ -489,7 +555,6 @@ Reason=Blocking RunCondition=NOT $(IS_LINUX) # TODO: debug NotParallelSafe=true # Creates/deletes a module with a static name 'test_imp_helper' - [CPython.test_import] Ignore=true Reason=ImportError: No module named _multiprocessing @@ -539,6 +604,10 @@ Ignore=true [CPython.test_lib2to3] Ignore=true +# TODO: 3.6 +#[CPython.test_linecache] +#Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/1245 - using the test_linecache_stdlib approach makes the issue disappear... + [CPython.test_list] IsolationLevel=ENGINE MaxRecursion=100 @@ -559,6 +628,7 @@ Reason=ImportError: No module named _lzma [CPython.test_macpath] RunCondition=NOT $(IS_MONO) # https://github.com/IronLanguages/ironpython3/issues/1102 +IsolationLevel=PROCESS # https://github.com/IronLanguages/ironpython3/issues/1440 [CPython.test_mailbox] Ignore=true @@ -579,6 +649,9 @@ IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages [CPython.test_metaclass] Ignore=true +[CPython.test_minidom] # IronPython.test_minidom_stdlib +Ignore=true + [CPython.test_mmap] RunCondition=NOT $(IS_MONO) AND (NOT $(IS_OSX) OR '$(FRAMEWORK)' <> '.NETCoreApp,Version=v6.0') IsolationLevel=PROCESS @@ -629,14 +702,19 @@ Ignore=true RunCondition=$(IS_WINDOWS) # TODO: failing on posix IsolationLevel=PROCESS # Manipulates environment variables +[CPython.test_opcodes] # IronPython.test_opcodes_stdlib +Ignore=true + [CPython.test_openpty] RunCondition=$(IS_POSIX) Ignore=true Reason=unittest.case.SkipTest: os.openpty() not available. +[CPython.test_ordered_dict] # IronPython.test_ordered_dict_stdlib +Ignore=true + [CPython.test_os] Ignore=true -Reason=AttributeError: 'module' object has no attribute 'isatty' [CPython.test_ossaudiodev] # Module has been removed in 3.13 - https://github.com/IronLanguages/ironpython3/issues/1352 Ignore=true @@ -657,18 +735,18 @@ Reason=Blocking [CPython.test_peepholer] Ignore=true -[CPython.test_pep277] +[CPython.test_pep277] # renamed to test_unicode_file_functions in 3.6 RunCondition=NOT $(IS_POSIX) # TODO: debug NotParallelSafe=true # Renames files to/from a static name 'tmp' -[CPython.test_pep380] # IronPython.test_pep380_stdlib +[CPython.test_pep380] # IronPython.test_yield_from_stdlib - renamed to test_yield_from in 3.6 Ignore=true -[CPython.test_pep3131] +[CPython.test_pep3131] # renamed to test_unicode_identifiers in 3.6 Ignore=true Reason=SyntaxError: invalid syntax -[CPython.test_pep3151] +[CPython.test_pep3151] # renamed to test_exception_hierarchy in 3.6 Ignore=true [CPython.test_pickle] @@ -693,6 +771,9 @@ Ignore=true [CPython.test_platform] RunCondition=NOT $(IS_OSX) +[CPython.test_plistlib] # IronPython.test_plistlib_stdlib +Ignore=true + [CPython.test_poll] RunCondition=$(IS_POSIX) Ignore=true @@ -710,6 +791,9 @@ Reason=AttributeError: module 'posix' has no attribute 'chown' [CPython.test_posixpath] Ignore=true +[CPython.test_print] # IronPython.test_print_stdlib +Ignore=true + [CPython.test_profile] Ignore=true @@ -749,8 +833,10 @@ 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_reprlib] Ignore=true @@ -782,9 +868,8 @@ Ignore=true [CPython.test_selectors] Ignore=true -[CPython.test_set] -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 +[CPython.test_set] # IronPython.test_set_stdlib +Ignore=true [CPython.test_shelve] NotParallelSafe=true @@ -814,7 +899,7 @@ Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/122 IsolationLevel=ENGINE # source file in a non-UTF-8 encoding [CPython.test_spwd] # Module has been removed in 3.13 - https://github.com/IronLanguages/ironpython3/issues/1352 -RunCondition=$(IS_POSIX) +RunCondition=$(IS_POSIX) AND NOT $(IS_OSX) # https://github.com/IronLanguages/ironpython3/issues/1545 [CPython.test_sqlite] Ignore=true @@ -832,10 +917,16 @@ Ignore=true [CPython.test_statistics] Ignore=true +[CPython.test_string_literals] # IronPython.test_string_literals_stdlib +Ignore=true + [CPython.test_stringprep] Ignore=true Reason=Requires unicode 3.2.0 data - https://github.com/IronLanguages/ironpython3/issues/691 +[CPython.test_strptime] # IronPython.test_strptime_stdlib +Ignore=true + [CPython.test_strtod] Ignore=true Reason=unittest.case.SkipTest: correctly-rounded string->float conversions not available on this system @@ -847,6 +938,9 @@ Ignore=true Ignore=true Reason=ImportError: No module named '_testcapi' +[CPython.test_subclassinit] # new in 3.6 +Ignore=true + [CPython.test_subprocess] RunCondition=NOT $(IS_POSIX) AND NOT $(IS_NETCOREAPP) # TODO: debug Reason=TODO: figure out @@ -862,11 +956,11 @@ Reason=ImportError: No module named audioop Ignore=true Reason=ImportError: No module named _msi -[CPython.test_super] -Ignore=false # will have to be ignored again in 3.6 +[CPython.test_super] # IronPython.test_super_stdlib +Ignore=true -[CPython.test_support] -RunCondition=NOT $(IS_POSIX) # TODO: debug +[CPython.test_support] # IronPython.test_support_stdlib +Ignore=true [CPython.test_symtable] Ignore=true @@ -902,7 +996,7 @@ Ignore=true [CPython.test_tcl] Ignore=true -Reason=ImportError: No module named '_tkinter' +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_telnetlib] # Module has been removed in 3.13 - https://github.com/IronLanguages/ironpython3/issues/1352 RunCondition=NOT $(IS_LINUX) # TODO: debug @@ -935,11 +1029,15 @@ Reason=unittest.case.SkipTest: Cant test signal on win32 Ignore=true [CPython.test_timeout] -RunCondition=NOT $(IS_MONO) AND NOT ($(IS_POSIX) AND $(IS_NETSTANDARD)) # TODO: investigate +RunCondition=NOT $(IS_MONO) AND NOT ($(IS_POSIX) AND $(IS_NETSTANDARD)) # https://github.com/IronLanguages/ironpython3/issues/1522 + other issues? + +[CPython.test_tix] # new in 3.5 +Ignore=true +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_tk] Ignore=true -Reason=ImportError: No module named '_tkinter' +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_tools] Ignore=true @@ -956,11 +1054,15 @@ Reason=ImportError: No module named _tracemalloc [CPython.test_ttk_guionly] Ignore=true -Reason=ImportError: No module named '_tkinter' +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_ttk_textonly] Ignore=true -Reason=ImportError: No module named '_tkinter' +Reason=unittest.case.SkipTest: No module named '_tkinter' + +[CPython.test_turtle] # new in 3.5 +Ignore=true +Reason=unittest.case.SkipTest: No module named '_tkinter' [CPython.test_types] # IronPython.test_types_stdlib Ignore=true @@ -978,6 +1080,14 @@ Ignore=true [CPython.test_unicode_file] Ignore=true +[CPython.test_unicode_file_functions] # used to be test_pep277 (renamed in 3.6) +RunCondition=NOT $(IS_POSIX) # TODO: debug +NotParallelSafe=true # Renames files to/from a static name 'tmp' + +[CPython.test_unicode_identifiers] # used to be test_pep3131 (renamed in 3.6) +Ignore=true +Reason=SyntaxError: invalid syntax + [CPython.test_unicodedata] Ignore=true @@ -1005,10 +1115,13 @@ Reason=TypeError: transient_internet() takes exactly 1 arguments (2 given) RunCondition=NOT $(IS_POSIX) Reason=https://github.com/IronLanguages/ironpython3/issues/581 -[CPython.test_userlist] +[CPython.test_userdict] IsolationLevel=ENGINE MaxRecursion=100 +[CPython.test_userlist] # IronPython.test_userlist_stdlib +Ignore=true + [CPython.test_utf8_mode] # IronPython.test_utf8_mode_stdlib Ignore=true @@ -1032,6 +1145,9 @@ Ignore=true [CPython.test_weakset] # IronPython.test_weakset_stdlib Ignore=true +[CPython.test_winconsoleio] # new in 3.6 +Ignore=true + [CPython.test_winreg] RunCondition=$(IS_WINDOWS) @@ -1055,6 +1171,9 @@ Ignore=true Ignore=true Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/issues/182 +[CPython.test_yield_from] # IronPython.test_yield_from_stdlib - used to be test_pep380 (renamed in 3.6) +Ignore=true + [CPython.test_zipfile] Ignore=true diff --git a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini index 46b840af3..57e527834 100644 --- a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini @@ -26,10 +26,6 @@ IsolationLevel=PROCESS # requires System.Drawing assembly to be unloaded [IronPython.test_compiler] IsolationLevel=PROCESS # TODO: figure out - breaks the sys module in other tests -[IronPython.test_dllsite] -Ignore=true -Reason=disabled in IronLanguages/main, needs lots of work - [IronPython.test_delegate] RetryCount=2 @@ -37,6 +33,14 @@ RetryCount=2 IsolationLevel=ENGINE MaxRecursion=100 +[IronPython.test_dict_stdlib] +IsolationLevel=ENGINE +MaxRecursion=100 + +[IronPython.test_dllsite] +Ignore=true +Reason=disabled in IronLanguages/main, needs lots of work + [IronPython.test_doc] RunCondition=NOT $(IS_OSX) # TODO: figure out IsolationLevel=PROCESS # required to have quit/exit @@ -101,12 +105,18 @@ RetryCount=2 IsolationLevel=PROCESS Arguments=-X:CompilationThreshold 0 "$(TEST_FILE)" # ensure CompilationThreshold is 0 otherwise tests are meaningless! +[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 + [IronPython.test_socket_stdlib] RunCondition=NOT $(IS_MONO) # TODO: figure out +Timeout=300000 # 5 minute timeout - sometimes slow [IronPython.test_sqlite3_stdlib] IsolationLevel=PROCESS RunCondition=NOT $(IS_OSX) # https://github.com/IronLanguages/ironpython3/issues/1483 +NotParallelSafe=true [IronPython.test_stdconsole] Timeout=600000 # 10 minute timeout @@ -134,6 +144,7 @@ Reason=StackOverflowException - https://github.com/IronLanguages/ironpython2/iss [IronPython.test_threading_stdlib] IsolationLevel=PROCESS +RunCondition=NOT $(IS_MONO) # TODO: figure out [IronPython.test_threadsafety] Ignore=true @@ -146,6 +157,10 @@ NotParallelSafe=true # Creates temporary fixed-name modules IsolationLevel=ENGINE MaxRecursion=100 +[IronPython.test_userlist_stdlib] +IsolationLevel=ENGINE +MaxRecursion=100 + [IronPython.test_weakref] RunCondition=NOT $(IS_MONO) # weakref failures diff --git a/tests/IronPython.Tests/Stress/Engine.cs b/tests/IronPython.Tests/Stress/Engine.cs index 3fe565880..003cb57ca 100644 --- a/tests/IronPython.Tests/Stress/Engine.cs +++ b/tests/IronPython.Tests/Stress/Engine.cs @@ -42,7 +42,9 @@ private static long GetTotalMemory() { } #if FEATURE_REFEMIT +#if !PYTHON_36 // TODO: figure out [Test] +#endif public void ScenarioXGC() { Assert.AreEqual(1, 1); // prevents nunit from counting towards memory usage diff --git a/tests/suite/gen_stdlib_test.py b/tests/suite/gen_stdlib_test.py index 7e472405c..f14948f93 100644 --- a/tests/suite/gen_stdlib_test.py +++ b/tests/suite/gen_stdlib_test.py @@ -22,12 +22,14 @@ ## Run selected tests from {name} from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import {package}test.{name} def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule({package}test.{name}) + tests = loader.loadTestsFromModule({package}test.{name}, pattern=pattern) if is_ironpython: {tests} diff --git a/tests/suite/modules/io_related/test_re.py b/tests/suite/modules/io_related/test_re.py index 49694a05f..a381e59f9 100644 --- a/tests/suite/modules/io_related/test_re.py +++ b/tests/suite/modules/io_related/test_re.py @@ -3,6 +3,7 @@ # See the LICENSE file in the project root for more information. import re +import sys import unittest from iptest import IronPythonTestCase, is_cli, run_test @@ -33,8 +34,16 @@ def test_sanity_re(self): ''' #compile self.assertTrue(hasattr(re.compile("(abc){1}"), "pattern")) - self.assertTrue(hasattr(re.compile("(abc){1}", re.L), "pattern")) - self.assertTrue(hasattr(re.compile("(abc){1}", flags=re.L), "pattern")) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.compile("(abc){1}", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.compile("(abc){1}", flags=re.L) + else: + self.assertTrue(hasattr(re.compile("(abc){1}", re.L), "pattern")) + self.assertTrue(hasattr(re.compile("(abc){1}", flags=re.L), "pattern")) + self.assertTrue(hasattr(re.compile(b"(abc){1}", re.L), "pattern")) + self.assertTrue(hasattr(re.compile(b"(abc){1}", flags=re.L), "pattern")) #I IGNORECASE L LOCAL MMULTILINE S DOTALL U UNICODE X VERBOSE flags = ["I", "IGNORECASE", @@ -50,15 +59,31 @@ def test_sanity_re(self): #search self.assertEqual(re.search("(abc){1}", ""), None) self.assertEqual(re.search("(abc){1}", "abcxyz").span(), (0,3)) - self.assertEqual(re.search("(abc){1}", "abcxyz", re.L).span(), (0,3)) - self.assertEqual(re.search("(abc){1}", "abcxyz", flags=re.L).span(), (0,3)) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.search("(abc){1}", "abcxyz", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.search("(abc){1}", "abcxyz", flags=re.L) + else: + self.assertEqual(re.search("(abc){1}", "abcxyz", re.L).span(), (0,3)) + self.assertEqual(re.search("(abc){1}", "abcxyz", flags=re.L).span(), (0,3)) + self.assertEqual(re.search(b"(abc){1}", b"abcxyz", re.L).span(), (0,3)) + self.assertEqual(re.search(b"(abc){1}", b"abcxyz", flags=re.L).span(), (0,3)) self.assertEqual(re.search("(abc){1}", "xyzabc").span(), (3,6)) #match self.assertEqual(re.match("(abc){1}", ""), None) self.assertEqual(re.match("(abc){1}", "abcxyz").span(), (0,3)) - self.assertEqual(re.match("(abc){1}", "abcxyz", re.L).span(), (0,3)) - self.assertEqual(re.match("(abc){1}", "abcxyz", flags=re.L).span(), (0,3)) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.match("(abc){1}", "abcxyz", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.match("(abc){1}", "abcxyz", flags=re.L) + else: + self.assertEqual(re.match("(abc){1}", "abcxyz", re.L).span(), (0,3)) + self.assertEqual(re.match("(abc){1}", "abcxyz", flags=re.L).span(), (0,3)) + self.assertEqual(re.match(b"(abc){1}", b"abcxyz", re.L).span(), (0,3)) + self.assertEqual(re.match(b"(abc){1}", b"abcxyz", flags=re.L).span(), (0,3)) #split self.assertEqual(re.split("(abc){1}", ""), ['']) @@ -76,15 +101,31 @@ def test_sanity_re(self): #findall self.assertEqual(re.findall("(abc){1}", ""), []) self.assertEqual(re.findall("(abc){1}", "abcxyz"), ['abc']) - self.assertEqual(re.findall("(abc){1}", "abcxyz", re.L), ['abc']) - self.assertEqual(re.findall("(abc){1}", "abcxyz", flags=re.L), ['abc']) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.findall("(abc){1}", "abcxyz", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.findall("(abc){1}", "abcxyz", flags=re.L) + else: + self.assertEqual(re.findall("(abc){1}", "abcxyz", re.L), ['abc']) + self.assertEqual(re.findall("(abc){1}", "abcxyz", flags=re.L), ['abc']) + self.assertEqual(re.findall(b"(abc){1}", b"abcxyz", re.L), [b'abc']) + self.assertEqual(re.findall(b"(abc){1}", b"abcxyz", flags=re.L), [b'abc']) self.assertEqual(re.findall("(abc){1}", "xyzabcabc"), ['abc', 'abc']) #finditer self.assertEqual([x.group() for x in re.finditer("(abc){1}", "")], []) self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz")], ['abc']) - self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", re.L)], ['abc']) - self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", flags=re.L)], ['abc']) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.finditer("(abc){1}", "abcxyz", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.finditer("(abc){1}", "abcxyz", flags=re.L) + else: + self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", re.L)], ['abc']) + self.assertEqual([x.group() for x in re.finditer("(abc){1}", "abcxyz", flags=re.L)], ['abc']) + self.assertEqual([x.group() for x in re.finditer(b"(abc){1}", b"abcxyz", re.L)], [b'abc']) + self.assertEqual([x.group() for x in re.finditer(b"(abc){1}", b"abcxyz", flags=re.L)], [b'abc']) self.assertEqual([x.group() for x in re.finditer("(abc){1}", "xyzabcabc")], ['abc', 'abc']) rex = re.compile("foo") for m in rex.finditer("this is a foo and a foo bar"): @@ -188,7 +229,12 @@ def test_sanity_re_pattern(self): #flags self.assertEqual(pattern.flags, re.U) - self.assertEqual(re.compile("(abc){1}", re.L).flags, re.L | re.U) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.compile("(abc){1}", re.L) + else: + self.assertEqual(re.compile("(abc){1}", re.L).flags, re.L | re.U) + self.assertEqual(re.compile(b"(abc){1}", re.L).flags, re.L) #groupindex self.assertEqual(pattern.groupindex, {}) @@ -514,18 +560,28 @@ def test_bug858(self): def test_finditer(self): # finditer - matches = re.finditer("baz","barbazbarbazbar") + matches = re.finditer("baz", "barbazbarbazbar") num = 0 for m in matches: num = num + 1 self.assertEqual("baz", m.group(0)) self.assertTrue(num == 2) - matches = re.finditer("baz","barbazbarbazbar", re.L) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.finditer("baz", "barbazbarbazbar", re.L) + else: + matches = re.finditer("baz", "barbazbarbazbar", re.L) + num = 0 + for m in matches: + num = num + 1 + self.assertEqual("baz", m.group(0)) + self.assertTrue(num == 2) + matches = re.finditer(b"baz", b"barbazbarbazbar", re.L) num = 0 for m in matches: num = num + 1 - self.assertEqual("baz", m.group(0)) + self.assertEqual(b"baz", m.group(0)) self.assertTrue(num == 2) matches = re.compile("baz").finditer("barbazbarbazbar", 0) @@ -623,8 +679,16 @@ def test_groups(self): def test_locale_flags(self): self.assertEqual(re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)").flags, re.U) - self.assertEqual(re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)", re.L).flags, re.L | re.U) - self.assertEqual(re.compile(r"(?L)^\#[ \t]*(\w[\d\w]*)[ \t](.*)").flags, re.L | re.U) + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)", re.L) + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + re.compile(r"(?L)^\#[ \t]*(\w[\d\w]*)[ \t](.*)") + else: + self.assertEqual(re.compile(r"^\#[ \t]*(\w[\d\w]*)[ \t](.*)", re.L).flags, re.L | re.U) + self.assertEqual(re.compile(r"(?L)^\#[ \t]*(\w[\d\w]*)[ \t](.*)").flags, re.L | re.U) + self.assertEqual(re.compile(rb"", re.L).flags, re.L) + self.assertEqual(re.compile(rb"(?L)").flags, re.L) def test_end(self): ex = re.compile(r'\s+') @@ -792,7 +856,12 @@ def test_cp35146(self): def test_cp35135(self): self.assertEqual(re.match(r"(?iu)aA", "aa").string, "aa") self.assertEqual(re.match(r"(?iu)Aa", "aa").string, "aa") - self.assertEqual(re.match(r"(?iLmsux)Aa", "aa").string, "aa") + if sys.version_info >= (3, 6): + with self.assertRaises(ValueError): # cannot use LOCALE flag with a str pattern + self.assertEqual(re.match(r"(?iLmsux)Aa", "aa").string, "aa") + else: + self.assertEqual(re.match(r"(?iLmsux)Aa", "aa").string, "aa") + self.assertEqual(re.match(r"(?imsux)Aa", "aa").string, "aa") def test_issue506(self): self.assertEqual(re.compile("^a", re.M).search("ba", 1), None) diff --git a/tests/suite/modules/misc/test_datetime.py b/tests/suite/modules/misc/test_datetime.py index 8a587a685..3b248a377 100644 --- a/tests/suite/modules/misc/test_datetime.py +++ b/tests/suite/modules/misc/test_datetime.py @@ -8,7 +8,7 @@ import datetime import os -import unittest +import sys from iptest import IronPythonTestCase, is_cli, run_test, skipUnlessIronPython @@ -985,7 +985,10 @@ def test_time(self): #bool self.assertTrue(datetime.time(0, 0, 0, 1)) #CodePlex Work Item 5139 - self.assertTrue(not (datetime.time(0, 0, 0, 0))) + if sys.version_info >= (3, 5): + self.assertFalse(not (datetime.time(0, 0, 0, 0))) # __bool__ removed in 3.5 + else: + self.assertTrue(not (datetime.time(0, 0, 0, 0))) #replace x = datetime.time(1, 2, 33, 444) diff --git a/tests/suite/modules/system_related/test_resource_stdlib.py b/tests/suite/modules/system_related/test_resource_stdlib.py index 9a649f7fd..020cf933b 100644 --- a/tests/suite/modules/system_related/test_resource_stdlib.py +++ b/tests/suite/modules/system_related/test_resource_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_resource from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_resource def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_resource) + tests = loader.loadTestsFromModule(test.test_resource, pattern=pattern) if is_ironpython: failing_tests = [] diff --git a/tests/suite/test_abc_stdlib.py b/tests/suite/test_abc_stdlib.py new file mode 100644 index 000000000..c9b68db92 --- /dev/null +++ b/tests/suite/test_abc_stdlib.py @@ -0,0 +1,32 @@ +# 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_abc from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_abc + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_abc, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_abc.TestABCWithInitSubclass('test_works_with_init_subclass'), # https://github.com/IronLanguages/ironpython3/issues/1448 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_array_stdlib.py b/tests/suite/test_array_stdlib.py new file mode 100644 index 000000000..53ffd094d --- /dev/null +++ b/tests/suite/test_array_stdlib.py @@ -0,0 +1,75 @@ +# 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_array from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_array + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_array, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_array.ByteTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ByteTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ByteTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ByteTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.DoubleTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.DoubleTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.FloatTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.FloatTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.IntTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.IntTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.IntTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongLongTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongLongTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongLongTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongLongTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.LongTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ShortTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ShortTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ShortTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.ShortTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnicodeTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnicodeTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedByteTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedByteTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedByteTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedByteTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedIntTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedIntTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedIntTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedIntTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongLongTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongLongTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongLongTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongLongTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedLongTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedShortTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedShortTest('test_overflow'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedShortTest('test_subclass_with_kwargs'), # https://github.com/IronLanguages/ironpython3/issues/767 + test.test_array.UnsignedShortTest('test_type_error'), # https://github.com/IronLanguages/ironpython3/issues/767 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_builtin_stdlib.py b/tests/suite/test_builtin_stdlib.py index d8abc5edf..e04445c0c 100644 --- a/tests/suite/test_builtin_stdlib.py +++ b/tests/suite/test_builtin_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_builtin from StdLib ## -from iptest import is_ironpython, generate_suite, run_test, is_netcoreapp +import sys + +from iptest import is_ironpython, generate_suite, run_test import test.test_builtin def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_builtin) + tests = loader.loadTestsFromModule(test.test_builtin, pattern=pattern) if is_ironpython: failing_tests = [ @@ -31,8 +33,17 @@ def load_tests(loader, standard_tests, pattern): test.test_builtin.PtyTests('test_input_tty_non_ascii_unicode_errors'), test.test_builtin.ShutdownTest('test_cleanup'), ] - if is_netcoreapp: + if sys.version_info >= (3, 6): skip_tests += [ + test.test_builtin.TestSorted('test_bad_arguments'), # AssertionError: TypeError not raised + test.test_builtin.TestType('test_bad_args'), # AssertionError: TypeError not raised + test.test_builtin.TestType('test_bad_slots'), # AssertionError: TypeError not raised + test.test_builtin.TestType('test_namespace_order'), # https://github.com/IronLanguages/ironpython3/issues/1468 + test.test_builtin.TestType('test_new_type'), # AssertionError: is not + test.test_builtin.TestType('test_type_doc'), # AssertionError: UnicodeEncodeError not raised + test.test_builtin.TestType('test_type_name'), # AssertionError: ValueError not raised + test.test_builtin.TestType('test_type_nokwargs'), # AssertionError: TypeError not raised + test.test_builtin.TestType('test_type_qualname'), # https://github.com/IronLanguages/ironpython3/issues/30 ] return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_bz2_stdlib.py b/tests/suite/test_bz2_stdlib.py index fbc98bd7b..9c2339d82 100644 --- a/tests/suite/test_bz2_stdlib.py +++ b/tests/suite/test_bz2_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_bz2 from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_bz2 def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_bz2) + tests = loader.loadTestsFromModule(test.test_bz2, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_call_stdlib.py b/tests/suite/test_call_stdlib.py new file mode 100644 index 000000000..f7cad70d1 --- /dev/null +++ b/tests/suite/test_call_stdlib.py @@ -0,0 +1,32 @@ +# 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_call from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_call + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_call, pattern=pattern) + + if is_ironpython: + failing_tests = [] + + skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_call.FunctionCalls('test_kwargs_order'), # intermittent failures due to https://github.com/IronLanguages/ironpython3/issues/1460 + ] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_class_stdlib.py b/tests/suite/test_class_stdlib.py index f8fb668ef..a8f405b1a 100644 --- a/tests/suite/test_class_stdlib.py +++ b/tests/suite/test_class_stdlib.py @@ -6,19 +6,23 @@ ## Run selected tests from test_class from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_class def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_class) + tests = loader.loadTestsFromModule(test.test_class, pattern=pattern) if is_ironpython: failing_tests = [ test.test_class.ClassTests('testForExceptionsRaisedInInstanceGetattr2'), # https://github.com/IronLanguages/ironpython3/issues/1530 ] - return generate_suite(tests, failing_tests) + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_code_module_stdlib.py b/tests/suite/test_code_module_stdlib.py new file mode 100644 index 000000000..14e188e0a --- /dev/null +++ b/tests/suite/test_code_module_stdlib.py @@ -0,0 +1,32 @@ +# 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_code_module from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_code_module + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_code_module, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_code_module.TestInteractiveConsole('test_context_tb'), # https://github.com/IronLanguages/ironpython3/issues/1557 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_codeccallbacks_stdlib.py b/tests/suite/test_codeccallbacks_stdlib.py index 920b8c568..e09e4046b 100644 --- a/tests/suite/test_codeccallbacks_stdlib.py +++ b/tests/suite/test_codeccallbacks_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_codeccallbacks from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono import test.test_codeccallbacks def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_codeccallbacks) + tests = loader.loadTestsFromModule(test.test_codeccallbacks, pattern=pattern) if is_ironpython: failing_tests = [ @@ -27,15 +29,23 @@ def load_tests(loader, standard_tests, pattern): test.test_codeccallbacks.CodecCallbackTest('test_unencodablereplacement'), # UnicodeEncodeError not raised by encode test.test_codeccallbacks.CodecCallbackTest('test_unicodedecodeerror'), # TypeError not raised by UnicodeDecodeError test.test_codeccallbacks.CodecCallbackTest('test_unicodeencodeerror'), # TypeError not raised by UnicodeEncodeError - test.test_codeccallbacks.CodecCallbackTest('test_unicodetranslateerror'), # UTF-16 vs. UTF-32 + test.test_codeccallbacks.CodecCallbackTest('test_unicodetranslateerror'), # UTF-16 vs. UTF-32 test.test_codeccallbacks.CodecCallbackTest('test_uninamereplace'), # bug? ] if is_mono: failing_tests += [ test.test_codeccallbacks.CodecCallbackTest('test_longstrings'), # https://github.com/mono/mono/issues/20445 ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_codeccallbacks.CodecCallbackTest('test_badandgoodnamereplaceexceptions'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codeccallbacks.CodecCallbackTest('test_badandgoodsurrogatepassexceptions'), # AssertionError: UnicodeEncodeError not raised by surrogatepass_errors + test.test_codeccallbacks.CodecCallbackTest('test_crashing_decode_handler'), # NotImplementedError: Moving a decoding cursor not implemented yet + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_codecs_stdlib.py b/tests/suite/test_codecs_stdlib.py index 061dc11b9..420d26df1 100644 --- a/tests/suite/test_codecs_stdlib.py +++ b/tests/suite/test_codecs_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_codecs from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono, is_netcoreapp, is_netcoreapp21 import test.test_codecs def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_codecs) + tests = loader.loadTestsFromModule(test.test_codecs, pattern=pattern) if is_ironpython: failing_tests = [ @@ -41,15 +43,44 @@ def load_tests(loader, standard_tests, pattern): if not is_netcoreapp or is_netcoreapp21: failing_tests += [ test.test_codecs.CP65001Test('test_decode'), # '[��]' != '[���]' (bug in .NET: dotnet/corefx#36163, fixed in .NET Core 3.x) - test.test_codecs.UTF8SigTest('test_lone_surrogates'), # AssertionError: '\ud803\udfff��A' != '\ud803\udfff���A' - test.test_codecs.UTF8Test('test_lone_surrogates'), # AssertionError: '\ud803\udfff��A' != '\ud803\udfff���A' ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_codecs.UTF8SigTest('test_lone_surrogates'), # AssertionError: '\ud803\udfff��A' != '\ud803\udfff���A' + test.test_codecs.UTF8Test('test_lone_surrogates'), # AssertionError: '\ud803\udfff��A' != '\ud803\udfff���A' + ] + if not is_mono: failing_tests += [ test.test_codecs.NameprepTest('test_nameprep'), # Invalid Unicode code point found at index 0 ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_codecs.ASCIITest('test_decode_error'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.CP65001Test('test_readline'), # code_page_decode issue - e.g. codecs.code_page_decode(65001, b'\xe3\x81') + test.test_codecs.CharmapTest('test_decode_with_int2int_map'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.CharmapTest('test_decode_with_int2str_map'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.CharmapTest('test_decode_with_string_map'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.EscapeDecodeTest('test_escape'), # AssertionError: DeprecationWarning not triggered + test.test_codecs.TypesTest('test_unicode_escape'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.UTF16BETest('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF16LETest('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF16Test('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF32BETest('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF32LETest('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF32Test('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF8SigTest('test_decode_error'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.UTF8SigTest('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF8SigTest('test_surrogatepass_handler'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF8Test('test_decode_error'), # https://github.com/IronLanguages/ironpython3/issues/1452 + test.test_codecs.UTF8Test('test_lone_surrogates'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UTF8Test('test_surrogatepass_handler'), # https://github.com/IronLanguages/ironpython3/issues/252 + test.test_codecs.UnicodeEscapeTest('test_escape_decode'), # AssertionError: DeprecationWarning not triggered + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_complex_stdlib.py b/tests/suite/test_complex_stdlib.py index baaff4167..5b0de9052 100644 --- a/tests/suite/test_complex_stdlib.py +++ b/tests/suite/test_complex_stdlib.py @@ -6,19 +6,27 @@ ## Run selected tests from test_complex from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_complex def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_complex) + tests = loader.loadTestsFromModule(test.test_complex, pattern=pattern) if is_ironpython: failing_tests = [ test.test_complex.ComplexTest('test_format'), ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_complex.ComplexTest('test_underscores'), # https://github.com/IronLanguages/ironpython3/issues/105 + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_datetime_stdlib.py b/tests/suite/test_datetime_stdlib.py index d1d23a2dd..a28f48233 100644 --- a/tests/suite/test_datetime_stdlib.py +++ b/tests/suite/test_datetime_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_datetime from StdLib ## +import sys + from iptest import is_ironpython, is_mono, is_arm64, generate_suite, run_test import test.datetimetester def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.datetimetester) + tests = loader.loadTestsFromModule(test.datetimetester, pattern=pattern) if is_ironpython: failing_tests = [ @@ -44,12 +46,95 @@ 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.IranTest('test_folds'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.IranTest('test_gaps'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.IranTest('test_system_transitions'), # AttributeError: 'module' object has no attribute 'tzset' + test.datetimetester.Oddballs('test_check_arg_types'), # TypeError: an integer is required + test.datetimetester.TestDate('test_compat_unpickle'), # TypeError: date() takes exactly 3 arguments (1 given) + test.datetimetester.TestDate('test_subclass_replace'), # TypeError: replace() got an unexpected keyword argument 'year' + test.datetimetester.TestDateTime('test_backdoor_resistance'), # AssertionError: "^bad tzinfo state arg$" does not match "function takes at least 3 arguments (2 given)" + test.datetimetester.TestDateTime('test_bad_constructor_arguments'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestDateTime('test_combine'), # TypeError: combine() takes exactly 2 arguments (3 given) + 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.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.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 + test.datetimetester.TestLocalTimeDisambiguation('test_fromtimestamp_low_fold_detection'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_fromutc'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_hash'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_hash_aware'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_member'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_mixed_compare_fold'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_mixed_compare_gap'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_pickle_fold'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_replace'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_repr'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_utcoffset'), # https://github.com/IronLanguages/ironpython3/issues/1459 + test.datetimetester.TestLocalTimeDisambiguation('test_vilnius_1941_fromutc'), # https://github.com/IronLanguages/ironpython3/issues/1459 + 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_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.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' + ] skip_tests = [] if is_mono and is_arm64: skip_tests += [ test.datetimetester.TestTimeDelta('test_overflow'), # rounding differences ] + if sys.version_info >= (3, 6): + for test_or_suite in tests: + if isinstance(test_or_suite, test.datetimetester.ZoneInfoCompleteTest): + for t in test_or_suite: + skip_tests.append(t) return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_descr_stdlib.py b/tests/suite/test_descr_stdlib.py index a0433a006..3388f3703 100644 --- a/tests/suite/test_descr_stdlib.py +++ b/tests/suite/test_descr_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_descr from StdLib ## +import sys + from iptest import is_ironpython, is_mono, generate_suite, run_test import test.test_descr def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_descr) + tests = loader.loadTestsFromModule(test.test_descr, pattern=pattern) if is_ironpython: failing_tests = [ @@ -25,7 +27,6 @@ def load_tests(loader, standard_tests, pattern): test.test_descr.ClassPropertiesAndMethods('test_mutable_bases'), # AttributeError: 'E' object has no attribute 'meth' test.test_descr.ClassPropertiesAndMethods('test_mutable_bases_catch_mro_conflict'), # AssertionError: didn't catch MRO conflict test.test_descr.ClassPropertiesAndMethods('test_mutable_bases_with_failing_mro'), # NotImplementedError: Overriding type.mro is not implemented - test.test_descr.ClassPropertiesAndMethods('test_properties'), # AssertionError: expected AttributeError from trying to set readonly '__doc__' attr on a property test.test_descr.ClassPropertiesAndMethods('test_proxy_call'), # AssertionError: TypeError not raised test.test_descr.ClassPropertiesAndMethods('test_qualname'), # AssertionError: 'member_descriptor' != 'getset_descriptor' test.test_descr.ClassPropertiesAndMethods('test_qualname_dict'), # AssertionError: 'Foo' != 'some.name' @@ -53,8 +54,21 @@ def load_tests(loader, standard_tests, pattern): test.test_descr.PicklingTests('test_reduce_copying'), # TypeError: __getnewargs__() takes exactly 1 argument (2 given) test.test_descr.PicklingTests('test_special_method_lookup'), # AssertionError: Tuples differ: (, (,), None) != (, (,), {}) ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_descr.ClassPropertiesAndMethods('test_properties'), # AssertionError: expected AttributeError from trying to set readonly '__doc__' attr on a property + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_descr.ClassPropertiesAndMethods('test_bound_method_repr'), # AssertionError: Regex didn't match + test.test_descr.ClassPropertiesAndMethods('test_object_class_assignment_between_heaptypes_and_nonheaptypes'), # TypeError: __class__ assignment: only for heap types + ] skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_descr.ClassPropertiesAndMethods('test_restored_object_new'), # TODO: marked as expectedFailure but doesn't fail + ] if is_mono: skip_tests += [ diff --git a/tests/suite/test_dict_stdlib.py b/tests/suite/test_dict_stdlib.py index ef7318b0e..b1d4738eb 100644 --- a/tests/suite/test_dict_stdlib.py +++ b/tests/suite/test_dict_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_dict from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono import test.test_dict def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_dict) + tests = loader.loadTestsFromModule(test.test_dict, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_file.py b/tests/suite/test_file.py index f79c9fa98..1a21a3e09 100644 --- a/tests/suite/test_file.py +++ b/tests/suite/test_file.py @@ -688,7 +688,7 @@ def test_errors(self): with self.assertRaises(OSError) as cm: open('path_too_long' * 100) - self.assertEqual(cm.exception.errno, (errno.ENAMETOOLONG if is_posix else errno.EINVAL) if is_netcoreapp or sys.version_info >= (3,6) else errno.ENOENT) + self.assertEqual(cm.exception.errno, (errno.ENAMETOOLONG if is_posix else errno.EINVAL) if is_netcoreapp or is_cpython and sys.version_info >= (3,6) else errno.ENOENT) def test_write_bytes(self): fname = self.temp_file diff --git a/tests/suite/test_fileinput_stdlib.py b/tests/suite/test_fileinput_stdlib.py new file mode 100644 index 000000000..8b3923b7e --- /dev/null +++ b/tests/suite/test_fileinput_stdlib.py @@ -0,0 +1,32 @@ +# 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_fileinput from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_fileinput + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_fileinput, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_fileinput.Test_hook_encoded('test_errors'), # https://github.com/IronLanguages/ironpython3/issues/1452 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_float_stdlib.py b/tests/suite/test_float_stdlib.py index cf7596132..7a7834d84 100644 --- a/tests/suite/test_float_stdlib.py +++ b/tests/suite/test_float_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_float from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_float def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_float) + tests = loader.loadTestsFromModule(test.test_float, pattern=pattern) if is_ironpython: failing_tests = [ @@ -24,8 +26,14 @@ def load_tests(loader, standard_tests, pattern): test.test_float.RoundTestCase('test_matches_float_format'), test.test_float.RoundTestCase('test_previous_round_bugs'), ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_float.GeneralFloatCases('test_underscores'), # https://github.com/IronLanguages/ironpython3/issues/105 + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_functools_stdlib.py b/tests/suite/test_functools_stdlib.py index 158d485d9..758fb74e3 100644 --- a/tests/suite/test_functools_stdlib.py +++ b/tests/suite/test_functools_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_functools from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono import test.test_functools def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_functools) + tests = loader.loadTestsFromModule(test.test_functools, pattern=pattern) if is_ironpython: failing_tests = [ @@ -22,17 +24,57 @@ def load_tests(loader, standard_tests, pattern): test.test_functools.TestCmpToKeyC('test_obj_field'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given) test.test_functools.TestCmpToKeyC('test_sort_int'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given) test.test_functools.TestCmpToKeyC('test_sort_int_str'), # TypeError: cmp_to_key() takes exactly 1 argument (2 given) - test.test_functools.TestPartialC('test_setstate_refcount'), # AttributeError: 'partial' object has no attribute '__setstate__' test.test_functools.TestPartialCSubclass('test_attributes_unwritable'), # AssertionError: AttributeError not raised by setattr test.test_functools.TestPartialCSubclass('test_repr'), # AssertionError - test.test_functools.TestPartialCSubclass('test_setstate_refcount'), # AttributeError: 'PartialSubclass' object has no attribute '__setstate__' ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_functools.TestPartialC('test_setstate_refcount'), # AttributeError: 'partial' object has no attribute '__setstate__' + test.test_functools.TestPartialCSubclass('test_setstate_refcount'), # AttributeError: 'PartialSubclass' object has no attribute '__setstate__' + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_functools.TestLRUC('test_lru_cache_threaded'), # unittest.expectedFailure( + test.test_functools.TestLRUC('test_pickle'), # pickle.PicklingError: Can't pickle + test.test_functools.TestLRUPy('test_lru_cache_threaded'), # AttributeError: 'module' object has no attribute 'getswitchinterval' + test.test_functools.TestLRUPy('test_pickle'), # pickle.PicklingError: Can't pickle + test.test_functools.TestPartialC('test_copy'), # AssertionError: (['asdf'],) is not (['asdf'],) + test.test_functools.TestPartialC('test_keystr_replaces_value'), # AssertionError: 'astr' not found in '' + test.test_functools.TestPartialC('test_nested_optimization'), # AssertionError: Tuples differ: (, (), {'bar': True}, {}) != (, ('asdf',), {'bar': True}, {}) + test.test_functools.TestPartialC('test_setstate'), # AssertionError: Tuples differ: (, (1,), {'a': 10}, {'attr': []}) != (, (1,), {'a': 10}, {}) + test.test_functools.TestPartialC('test_setstate_subclasses'), # AssertionError: is not + test.test_functools.TestPartialCSubclass('test_copy'), # AttributeError: 'partial' object has no attribute 'attr' + test.test_functools.TestPartialCSubclass('test_deepcopy'), # AttributeError: 'partial' object has no attribute 'attr' + test.test_functools.TestPartialCSubclass('test_keystr_replaces_value'), # AssertionError: 'astr' not found in '' + test.test_functools.TestPartialCSubclass('test_recursive_repr'), # AssertionError: 'functools.partial(...)' != 'CPartialSubclass(...)' + test.test_functools.TestPartialCSubclass('test_setstate'), # AssertionError: Tuples differ: (, (1,), {'a': 10}, {'attr': []}) != (, (1,), {'a': 10}, {}) + test.test_functools.TestPartialCSubclass('test_setstate_subclasses'), # AssertionError: is not + test.test_functools.TestTotalOrdering('test_pickle'), # pickle.PicklingError: Can't pickle + ] skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_functools.TestLRUC('test_kwargs_order'), # intermittent failures - https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_functools.TestLRUC('test_lru_cache_threaded2'), # intermittent failures + test.test_functools.TestLRUC('test_lru_cache_threaded3'), # intermittent failures + test.test_functools.TestLRUPy('test_kwargs_order'), # intermittent failures - https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_functools.TestLRUPy('test_lru_cache_threaded2'), # intermittent failures + test.test_functools.TestLRUPy('test_lru_cache_threaded3'), # intermittent failures + test.test_functools.TestPartialC('test_recursive_pickle'), # StackOverflowException + test.test_functools.TestPartialCSubclass('test_recursive_pickle'), # StackOverflowException + test.test_functools.TestPartialPy('test_recursive_pickle'), # # StackOverflowException + test.test_functools.TestPartialPySubclass('test_recursive_pickle'), # StackOverflowException + ] if is_mono: skip_tests += [ test.test_functools.TestPartialPy('test_weakref'), ] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_functools.TestPartialCSubclass('test_weakref'), + test.test_functools.TestPartialPySubclass('test_weakref'), + ] return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_grammar_stdlib.py b/tests/suite/test_grammar_stdlib.py new file mode 100644 index 000000000..5678f7d34 --- /dev/null +++ b/tests/suite/test_grammar_stdlib.py @@ -0,0 +1,41 @@ +# 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_grammar from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_grammar + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_grammar, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_grammar.GrammarTests('test_former_statements_refer_to_builtins'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_grammar.GrammarTests('test_var_annot_basic_semantics'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_custom_maps'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_metaclass_semantics'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_module_semantics'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_refleak'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_simple_exec'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_var_annot_syntax_errors'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_grammar.GrammarTests('test_yield'), # NotImplementedError: The method or operation is not implemented. + test.test_grammar.TokenTests('test_underscore_literals'), # https://github.com/IronLanguages/ironpython3/issues/105 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_httplib_stdlib.py b/tests/suite/test_httplib_stdlib.py index 46589a17e..bc09d84f3 100644 --- a/tests/suite/test_httplib_stdlib.py +++ b/tests/suite/test_httplib_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_httplib from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono, is_osx import test.test_httplib def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_httplib) + tests = loader.loadTestsFromModule(test.test_httplib, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_imp.py b/tests/suite/test_imp.py index 863ab6f66..f869011e6 100644 --- a/tests/suite/test_imp.py +++ b/tests/suite/test_imp.py @@ -319,25 +319,25 @@ def test_sys_path_none_builtins(self): #import some builtin modules not previously imported try: sys.path = [None] + prevPath - self.assertNotIn('array', sorted(sys.modules.keys())) - import array - self.assertIn('array', sys.modules) + self.assertNotIn('_csv', sorted(sys.modules.keys())) + import _csv + self.assertIn('_csv', sys.modules) sys.path = prevPath + [None] self.assertNotIn('cmath', sys.modules) - import array + import _csv import cmath - self.assertIn('array', sys.modules) + self.assertIn('_csv', sys.modules) self.assertIn('cmath', sys.modules) sys.path = [None] - self.assertNotIn('_bisect', sys.modules) - import array + self.assertNotIn('xxsubtype', sys.modules) + import _csv import cmath - import _bisect - self.assertIn('array', sys.modules) + import xxsubtype + self.assertIn('_csv', sys.modules) self.assertIn('cmath', sys.modules) - self.assertIn('_bisect', sys.modules) + self.assertIn('xxsubtype', sys.modules) finally: sys.path = prevPath diff --git a/tests/suite/test_io_stdlib.py b/tests/suite/test_io_stdlib.py index 344eef760..87c01b413 100644 --- a/tests/suite/test_io_stdlib.py +++ b/tests/suite/test_io_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_io from StdLib ## +import sys + from iptest import is_ironpython, is_mono, is_windows, generate_suite, run_test import test.test_io def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_io) + tests = loader.loadTestsFromModule(test.test_io, pattern=pattern) if is_ironpython: failing_tests = [ @@ -22,21 +24,13 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CIOTest('test_TextIOBase_destructor'), # AssertionError: Lists differ: [1, 2, 3, 2] != [1, 2, 3] test.test_io.CIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3] test.test_io.CIOTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close - test.test_io.CIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CIOTest('test_invalid_operations'), # OSError: can't do nonzero cur-relative seeks - test.test_io.CIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path. - test.test_io.PyIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3] - test.test_io.PyIOTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close - test.test_io.PyIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning - test.test_io.PyIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path. test.test_io.CBufferedReaderTest('test_args_error'), # AssertionError: "BufferedReader" does not match "__init__() takes at most 2 arguments (4 given)" test.test_io.CBufferedReaderTest('test_buffering'), # TypeError: BufferedReader() takes at least 0 arguments (2 given) test.test_io.CBufferedReaderTest('test_close_error_on_close'), # AssertionError: None is not an instance of - test.test_io.CBufferedReaderTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CBufferedReaderTest('test_initialization'), # AssertionError: ValueError not raised by read test.test_io.CBufferedReaderTest('test_misbehaved_io_read'), # AssertionError: OSError not raised by read test.test_io.CBufferedReaderTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of - test.test_io.CBufferedReaderTest('test_override_destructor'), # AssertionError: Lists differ: [1, 2, 3, 2] != [1, 2, 3] test.test_io.CBufferedReaderTest('test_read_non_blocking'), # AssertionError: b'' is not None test.test_io.CBufferedReaderTest('test_read_on_closed'), # AssertionError: ValueError not raised by read1 test.test_io.CBufferedReaderTest('test_readonly_attributes'), # AssertionError: AttributeError not raised @@ -44,7 +38,6 @@ def load_tests(loader, standard_tests, pattern): test.test_io.PyBufferedReaderTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of test.test_io.PyBufferedReaderTest('test_read_on_closed'), # AssertionError: ValueError not raised by read1 test.test_io.CBufferedWriterTest('test_close_error_on_close'), # AssertionError: None is not an instance of - test.test_io.CBufferedWriterTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CBufferedWriterTest('test_initialization'), # AssertionError: ValueError not raised by write test.test_io.CBufferedWriterTest('test_max_buffer_size_removal'), # AssertionError: TypeError not raised test.test_io.CBufferedWriterTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of @@ -58,7 +51,6 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CBufferedRWPairTest('test_uninitialized'), # TypeError: BufferedRWPair() takes at least 2 arguments (0 given) test.test_io.PyBufferedRWPairTest('test_reader_writer_close_error_on_close'), # AssertionError: None is not an instance of test.test_io.CBufferedRandomTest('test_close_error_on_close'), # AssertionError: None is not an instance of - test.test_io.CBufferedRandomTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CBufferedRandomTest('test_max_buffer_size_removal'), # AssertionError: TypeError not raised test.test_io.CBufferedRandomTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of test.test_io.CBufferedRandomTest('test_read_non_blocking'), # AssertionError: b'' is not None @@ -74,7 +66,6 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CTextIOWrapperTest('test_close_error_on_close'), # AssertionError: OSError not raised test.test_io.CTextIOWrapperTest('test_encoded_writes'), # UnicodeEncodeError test.test_io.CTextIOWrapperTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close - test.test_io.CTextIOWrapperTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning test.test_io.CTextIOWrapperTest('test_initialization'), # AssertionError: ValueError not raised by read test.test_io.CTextIOWrapperTest('test_non_text_encoding_codecs_are_rejected'), # AssertionError: LookupError not raised test.test_io.CTextIOWrapperTest('test_nonnormalized_close_error_on_close'), # AssertionError: NameError not raised @@ -95,10 +86,57 @@ def load_tests(loader, standard_tests, pattern): 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_pickling'), # AssertionError: TypeError not raised by _dumps test.test_io.PyMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered test.test_io.PyMiscIOTest('test_warn_on_dealloc_fd'), # AssertionError: ResourceWarning not triggered ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_io.CIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.CIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path. + test.test_io.PyIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3] + test.test_io.PyIOTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close + test.test_io.PyIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.PyIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path. + test.test_io.CBufferedReaderTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.CBufferedReaderTest('test_override_destructor'), # AssertionError: Lists differ: [1, 2, 3, 2] != [1, 2, 3] + 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_pickling'), # AssertionError: TypeError not raised by _dumps + ] + if sys.version_info >= (3, 6): + failing_tests += [ + # BufferError: memoryview: invalid buffer exported from object of type EmptyStruct + test.test_io.CIOTest('test_buffered_file_io'), + test.test_io.CIOTest('test_raw_bytes_io'), + test.test_io.CIOTest('test_raw_file_io'), + test.test_io.PyIOTest('test_buffered_file_io'), + test.test_io.PyIOTest('test_raw_bytes_io'), + test.test_io.PyIOTest('test_raw_file_io'), + test.test_io.CBufferedRWPairTest('test_readinto'), + test.test_io.PyBufferedRWPairTest('test_readinto'), + + # TODO: these are new in 3.6 + test.test_io.CIOTest('test_BufferedIOBase_readinto'), + test.test_io.CIOTest('test_buffered_readinto_mixin'), + test.test_io.CIOTest('test_next_nonsizeable'), + test.test_io.CIOTest('test_optional_abilities'), + test.test_io.PyIOTest('test_buffered_readinto_mixin'), + test.test_io.PyIOTest('test_optional_abilities'), + test.test_io.APIMismatchTest('test_RawIOBase_io_in_pyio_match'), + test.test_io.APIMismatchTest('test_RawIOBase_pyio_in_io_match'), + test.test_io.CBufferedReaderTest('test_readinto1'), + test.test_io.CBufferedReaderTest('test_readinto1_array'), + test.test_io.CBufferedReaderTest('test_readinto_array'), + test.test_io.CBufferedRandomTest('test_readinto1'), + test.test_io.CBufferedRandomTest('test_readinto1_array'), + test.test_io.CBufferedRandomTest('test_readinto_array'), + test.test_io.CTextIOWrapperTest('test_illegal_encoder'), + test.test_io.CTextIOWrapperTest('test_issue25862'), + test.test_io.CTextIOWrapperTest('test_read_byteslike'), + test.test_io.PyTextIOWrapperTest('test_illegal_encoder'), + test.test_io.PyTextIOWrapperTest('test_read_byteslike'), + ] if is_mono or is_windows: failing_tests += [ @@ -142,6 +180,29 @@ def load_tests(loader, standard_tests, pattern): test.test_io.CMiscIOTest('test_attributes'), # AssertionError: 'r' != 'U' test.test_io.PyMiscIOTest('test_attributes'), # AssertionError: 'wb+' != 'rb+' ] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_io.CBufferedReaderTest('test_override_destructor'), # StackOverflowException + + # failure prevents files from closing + test.test_io.CIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.PyIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + test.test_io.CBufferedReaderTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning + 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.PyIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3] + + # StackOverflowException + test.test_io.CBufferedReaderTest('test_recursive_repr'), + test.test_io.PyBufferedReaderTest('test_recursive_repr'), + test.test_io.CBufferedWriterTest('test_recursive_repr'), + test.test_io.PyBufferedWriterTest('test_recursive_repr'), + test.test_io.CBufferedRandomTest('test_recursive_repr'), + test.test_io.PyBufferedRandomTest('test_recursive_repr'), + test.test_io.CTextIOWrapperTest('test_recursive_repr'), + test.test_io.PyTextIOWrapperTest('test_recursive_repr'), + ] if is_mono: skip_tests += [ diff --git a/tests/suite/test_itertools_stdlib.py b/tests/suite/test_itertools_stdlib.py index 4986bb641..60feaed09 100644 --- a/tests/suite/test_itertools_stdlib.py +++ b/tests/suite/test_itertools_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_itertools from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_itertools def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_itertools) + tests = loader.loadTestsFromModule(test.test_itertools, pattern=pattern) if is_ironpython: failing_tests = [ @@ -32,8 +34,15 @@ def load_tests(loader, standard_tests, pattern): test.test_itertools.TestBasicOps('test_zip_longest_pickling'), test.test_itertools.TestVariousIteratorArgs('test_compress'), ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_itertools.TestBasicOps('test_cycle_setstate'), # __setstate__ not implemented + test.test_itertools.TestExamples('test_accumulate_reducible_none'), # pickling + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_long_stdlib.py b/tests/suite/test_long_stdlib.py index 293866dbb..91dbf6032 100644 --- a/tests/suite/test_long_stdlib.py +++ b/tests/suite/test_long_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_long from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_long def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_long) + tests = loader.loadTestsFromModule(test.test_long, pattern=pattern) if is_ironpython: failing_tests = [ @@ -21,7 +23,9 @@ def load_tests(loader, standard_tests, pattern): test.test_long.LongTest('test_true_division'), # https://github.com/IronLanguages/ironpython3/issues/907 ] - return generate_suite(tests, failing_tests) + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_memoryio_stdlib.py b/tests/suite/test_memoryio_stdlib.py index 423c895ae..2fa7a282f 100644 --- a/tests/suite/test_memoryio_stdlib.py +++ b/tests/suite/test_memoryio_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_memoryio from StdLib ## +import sys + from iptest import is_ironpython, is_mono, generate_suite, run_test import test.test_memoryio def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_memoryio) + tests = loader.loadTestsFromModule(test.test_memoryio, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_minidom_stdlib.py b/tests/suite/test_minidom_stdlib.py new file mode 100644 index 000000000..d036336b9 --- /dev/null +++ b/tests/suite/test_minidom_stdlib.py @@ -0,0 +1,33 @@ +# 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_minidom from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_minidom + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_minidom, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_minidom.MinidomTest('testCloneNodeEntity'), # https://github.com/IronLanguages/ironpython2/issues/464 + test.test_minidom.MinidomTest('testEncodings'), # https://github.com/IronLanguages/ironpython2/issues/464 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_opcodes_stdlib.py b/tests/suite/test_opcodes_stdlib.py new file mode 100644 index 000000000..d8163cf3b --- /dev/null +++ b/tests/suite/test_opcodes_stdlib.py @@ -0,0 +1,34 @@ +# 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_opcodes from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_opcodes + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_opcodes, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_opcodes.OpcodeTest('test_do_not_recreate_annotations'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_opcodes.OpcodeTest('test_setup_annotations_line'), # https://github.com/IronLanguages/ironpython3/issues/106 + test.test_opcodes.OpcodeTest('test_use_existing_annotations'), # https://github.com/IronLanguages/ironpython3/issues/106 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_ordered_dict_stdlib.py b/tests/suite/test_ordered_dict_stdlib.py new file mode 100644 index 000000000..311061931 --- /dev/null +++ b/tests/suite/test_ordered_dict_stdlib.py @@ -0,0 +1,76 @@ +# 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_ordered_dict from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test, is_mono + +if sys.version_info >= (3, 6): + import test.test_ordered_dict + +def load_tests(loader, standard_tests, pattern): + if sys.version_info < (3, 6): + return standard_tests + + tests = loader.loadTestsFromModule(test.test_ordered_dict, pattern=pattern) + + if is_ironpython: + failing_tests = [ + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_468'), # https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_copying'), # pickle.PicklingError + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_free_after_iterating'), # AssertionError + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_iterators_pickling'), # pickle.PicklingError + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_key_change_during_iteration'), # AssertionError: RuntimeError not raised + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_pickle_recursive'), # pickle.PicklingError + test.test_ordered_dict.CPythonOrderedDictTests('test_468'), # https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_ordered_dict.CPythonOrderedDictTests('test_free_after_iterating'), # AssertionError + test.test_ordered_dict.CPythonOrderedDictTests('test_iterators_pickling'), # pickle.PicklingError + test.test_ordered_dict.CPythonOrderedDictTests('test_key_change_during_iteration'), # AssertionError: RuntimeError not raised + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_468'), # https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_copying'), # pickle.PicklingError + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_free_after_iterating'), # AssertionError + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_pickle_recursive'), # pickle.PicklingError + test.test_ordered_dict.PurePythonOrderedDictTests('test_468'), # https://github.com/IronLanguages/ironpython3/issues/1460 + test.test_ordered_dict.PurePythonOrderedDictTests('test_free_after_iterating'), # AssertionError + ] + + skip_tests = [ + # https://github.com/IronLanguages/ironpython3/issues/1556 + test.test_ordered_dict.CPythonBuiltinDictTests('test_abc'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_clear'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_delitem'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_delitem_hash_collision'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_detect_deletion_during_iteration'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_highly_nested'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_highly_nested_subclass'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_init'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_override_update'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_popitem'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_reinsert'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_setitem'), + test.test_ordered_dict.CPythonBuiltinDictTests('test_update'), + + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_highly_nested_subclass'), # intermittent AssertionError - GC related? + test.test_ordered_dict.CPythonOrderedDictTests('test_highly_nested_subclass'), # intermittent AssertionError - GC related? + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_highly_nested_subclass'), # intermittent AssertionError - GC related? + test.test_ordered_dict.PurePythonOrderedDictTests('test_highly_nested_subclass'), # intermittent AssertionError - GC related? + ] + if is_mono: # maybe https://github.com/IronLanguages/ironpython3/issues/544 + skip_tests += [ + test.test_ordered_dict.PurePythonOrderedDictSubclassTests('test_reference_loop'), + test.test_ordered_dict.PurePythonOrderedDictTests('test_reference_loop'), + test.test_ordered_dict.CPythonOrderedDictSubclassTests('test_reference_loop'), + test.test_ordered_dict.CPythonOrderedDictTests('test_reference_loop'), + ] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_pep380_stdlib.py b/tests/suite/test_pep380_stdlib.py deleted file mode 100644 index a8c779399..000000000 --- a/tests/suite/test_pep380_stdlib.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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_pep380 from StdLib -## - -from iptest import is_ironpython, generate_suite, run_test - -import test.test_pep380 - -def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_pep380) - - if is_ironpython: - failing_tests = [ - test.test_pep380.TestPEP380Operation('test_broken_getattr_handling'), # TODO: figure out - test.test_pep380.TestPEP380Operation('test_catching_exception_from_subgen_and_returning'), # TODO: figure out - ] - - return generate_suite(tests, failing_tests) - - else: - return tests - -run_test(__name__) diff --git a/tests/suite/test_plistlib_stdlib.py b/tests/suite/test_plistlib_stdlib.py new file mode 100644 index 000000000..f87e4d0f5 --- /dev/null +++ b/tests/suite/test_plistlib_stdlib.py @@ -0,0 +1,40 @@ +# 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_plistlib from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_plistlib + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_plistlib, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_plistlib.TestBinaryPlistlib('test_identity'), # AssertionError: b'abcde' != Data(b'abcde') + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_plistlib.TestPlistlib('test_xml_plist_with_entity_decl'), # https://github.com/IronLanguages/ironpython2/issues/464 + ] + + skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_plistlib.TestBinaryPlistlib('test_deep_nesting'), # StackOverflowException + ] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_print_stdlib.py b/tests/suite/test_print_stdlib.py new file mode 100644 index 000000000..1aabb3e9c --- /dev/null +++ b/tests/suite/test_print_stdlib.py @@ -0,0 +1,38 @@ +# 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_print from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_print + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_print, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_print.TestPy2MigrationHint('test_normal_string'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_stream_redirection_hint_for_py2_migration'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_string_in_loop_on_same_line'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_string_with_excessive_whitespace'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_string_with_leading_whitespace'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_string_with_semicolon'), # https://github.com/IronLanguages/ironpython3/issues/374 + test.test_print.TestPy2MigrationHint('test_string_with_soft_space'), # https://github.com/IronLanguages/ironpython3/issues/374 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_re_stdlib.py b/tests/suite/test_re_stdlib.py index d30f2987e..c7edfe704 100644 --- a/tests/suite/test_re_stdlib.py +++ b/tests/suite/test_re_stdlib.py @@ -6,19 +6,20 @@ ## Run selected tests from test_re from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_re def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_re) + tests = loader.loadTestsFromModule(test.test_re, pattern=pattern) if is_ironpython: failing_tests = [ test.test_re.ExternalTests('test_re_tests'), test.test_re.ReTests('test_ascii_and_unicode_flag'), test.test_re.ReTests('test_backref_group_name_in_exception'), - test.test_re.ReTests('test_bug_13899'), test.test_re.ReTests('test_bug_1661'), test.test_re.ReTests('test_bug_581080'), test.test_re.ReTests('test_bug_764548'), @@ -47,8 +48,33 @@ def load_tests(loader, standard_tests, pattern): test.test_re.ReTests('test_symbolic_groups'), test.test_re.ReTests('test_symbolic_refs'), ] + if sys.version_info < (3, 6): + failing_tests += [ + test.test_re.ReTests('test_bug_13899'), + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_re.ReTests('test_bug_29444'), # AssertionError + test.test_re.ReTests('test_character_set_errors'), # AttributeError: 'error' object has no attribute 'msg' + test.test_re.ReTests('test_enum'), # AssertionError: 'ASCII' not found in '256' + test.test_re.ReTests('test_error'), # AttributeError: 'error' object has no attribute 'pattern' + test.test_re.ReTests('test_match_getitem'), # TypeError: expected dict, got Match + test.test_re.ReTests('test_misc_errors'), # AttributeError: 'error' object has no attribute 'msg' + test.test_re.ReTests('test_multiple_repeat'), # AttributeError: 'error' object has no attribute 'msg' + test.test_re.ReTests('test_nothing_to_repeat'), # AttributeError: 'error' object has no attribute 'msg' + test.test_re.ReTests('test_other_escapes'), # AssertionError: error not raised by compile + test.test_re.ReTests('test_qualified_re_split'), # AssertionError: FutureWarning not triggered + test.test_re.ReTests('test_re_groupref'), # AssertionError: error not raised + test.test_re.ReTests('test_re_groupref_exists'), # AssertionError: error not raised + test.test_re.ReTests('test_re_groupref_overflow'), # IndexError: unknown group reference + test.test_re.ReTests('test_re_split'), # AssertionError: FutureWarning not triggered + test.test_re.ReTests('test_repeat_minmax'), # AttributeError: 'error' object has no attribute 'msg' + test.test_re.ReTests('test_scoped_flags'), # https://github.com/IronLanguages/ironpython3/issues/1419 + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_sax_stdlib.py b/tests/suite/test_sax_stdlib.py index 90ec73e5a..e0d059fbf 100644 --- a/tests/suite/test_sax_stdlib.py +++ b/tests/suite/test_sax_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_sax from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_sax def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_sax) + tests = loader.loadTestsFromModule(test.test_sax, pattern=pattern) if is_ironpython: failing_tests = [ @@ -52,7 +54,9 @@ def load_tests(loader, standard_tests, pattern): test.test_sax.WriterXmlgenTest('test_xmlgen_unencodable'), # TypeError: expected long, got NoneType ] - return generate_suite(tests, failing_tests) + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_scope_stdlib.py b/tests/suite/test_scope_stdlib.py index b9f8138f5..5e1da0134 100644 --- a/tests/suite/test_scope_stdlib.py +++ b/tests/suite/test_scope_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_scope from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_scope def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_scope) + tests = loader.loadTestsFromModule(test.test_scope, pattern=pattern) if is_ironpython: failing_tests = [] diff --git a/tests/suite/test_set_stdlib.py b/tests/suite/test_set_stdlib.py new file mode 100644 index 000000000..b12b8ccc1 --- /dev/null +++ b/tests/suite/test_set_stdlib.py @@ -0,0 +1,38 @@ +# 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_set from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_set + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_set, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_set.TestFrozenSet('test_do_not_rehash_dict_keys'), # https://github.com/IronLanguages/ironpython3/issues/848 + test.test_set.TestFrozenSet('test_hash_effectiveness'), # https://github.com/IronLanguages/ironpython3/issues/1538 + test.test_set.TestFrozenSetSubclass('test_do_not_rehash_dict_keys'), # https://github.com/IronLanguages/ironpython3/issues/848 + test.test_set.TestFrozenSetSubclass('test_hash_effectiveness'), # https://github.com/IronLanguages/ironpython3/issues/1538 + test.test_set.TestSet('test_do_not_rehash_dict_keys'), # https://github.com/IronLanguages/ironpython3/issues/848 + test.test_set.TestSetSubclass('test_do_not_rehash_dict_keys'), # https://github.com/IronLanguages/ironpython3/issues/848 + test.test_set.TestSetSubclassWithKeywordArgs('test_do_not_rehash_dict_keys'), # https://github.com/IronLanguages/ironpython3/issues/848 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_socket_stdlib.py b/tests/suite/test_socket_stdlib.py index 247429f58..4754b7304 100644 --- a/tests/suite/test_socket_stdlib.py +++ b/tests/suite/test_socket_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_socket from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_linux, is_osx, net_version, is_mono, is_posix import test.test_socket def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_socket) + tests = loader.loadTestsFromModule(test.test_socket, pattern=pattern) if is_ironpython: failing_tests = [ @@ -35,11 +37,18 @@ def load_tests(loader, standard_tests, pattern): test.test_socket.TestSocketSharing('testShareLocal'), # https://github.com/IronLanguages/ironpython3/issues/1226 test.test_socket.TestSocketSharing('testTypes'), # https://github.com/IronLanguages/ironpython3/issues/1226 test.test_socket.UnbufferedFileObjectClassTestCase('testSmallReadNonBlocking'), # TODO: figure out - ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_socket.GeneralModuleTests('testCloseException'), # TODO: figure out + ] + if is_posix: # https://github.com/IronLanguages/ironpython3/pull/1638#discussion_r1059535867 + failing_tests += [ + test.test_socket.GeneralModuleTests('test_socket_fileno_requires_socket_fd'), + ] if is_linux or (is_osx and net_version < (10, 0)): failing_tests += [ - test.test_socket.NonBlockingTCPTests('testRecv'), # TODO: figure out + test.test_socket.NonBlockingTCPTests('testRecv'), # TODO: figure out ] if is_linux: failing_tests += [ diff --git a/tests/suite/test_sqlite3_stdlib.py b/tests/suite/test_sqlite3_stdlib.py index cfff554ab..ae70a2671 100644 --- a/tests/suite/test_sqlite3_stdlib.py +++ b/tests/suite/test_sqlite3_stdlib.py @@ -6,6 +6,8 @@ ## Run selected tests from sqlite3.test from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_linux import sqlite3.test.dbapi @@ -20,7 +22,7 @@ import test.test_sqlite def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_sqlite) + tests = loader.loadTestsFromModule(test.test_sqlite, pattern=pattern) if is_ironpython: failing_tests = [ @@ -73,7 +75,6 @@ def load_tests(loader, standard_tests, pattern): sqlite3.test.regression.RegressionTests('CheckNullCharacter'), sqlite3.test.regression.RegressionTests('CheckOnConflictRollback'), sqlite3.test.regression.RegressionTests('CheckRecursiveCursorUse'), - sqlite3.test.regression.RegressionTests('CheckSetDict'), sqlite3.test.regression.RegressionTests('CheckStrSubclass'), sqlite3.test.regression.RegressionTests('CheckTypeMapUsage'), sqlite3.test.transactions.TransactionTests('CheckRollbackCursorConsistency'), @@ -91,6 +92,32 @@ def load_tests(loader, standard_tests, pattern): sqlite3.test.userfunctions.FunctionTests('CheckParamBlob'), sqlite3.test.userfunctions.FunctionTests('CheckParamLongLong'), ] + if sys.version_info < (3, 6): + failing_tests += [ + sqlite3.test.regression.RegressionTests('CheckSetDict'), + ] + if sys.version_info >= (3, 6): + failing_tests += [ + sqlite3.test.dbapi.CursorTests('CheckExecuteNonIterable'), + sqlite3.test.dbapi.CursorTests('CheckLastRowIDOnReplace'), + sqlite3.test.dbapi.ExtensionTests('CheckCursorExecutescriptAsBytes'), + sqlite3.test.factory.CursorFactoryTests('CheckInvalidFactory'), + sqlite3.test.factory.RowFactoryTests('CheckFakeCursorClass'), + sqlite3.test.factory.RowFactoryTests('CheckSqliteRowSlice'), + sqlite3.test.hooks.CollationTests('CheckCreateCollationBadUpper'), + sqlite3.test.hooks.CollationTests('CheckCreateCollationNotString'), + sqlite3.test.regression.RegressionTests('CheckBpo31770'), + sqlite3.test.regression.RegressionTests('CheckCommitCursorReset'), + sqlite3.test.regression.RegressionTests('CheckSetIsolationLevel'), + sqlite3.test.regression.UnhashableCallbacksTestCase('test_progress_handler'), + sqlite3.test.regression.UnhashableCallbacksTestCase('test_func'), + sqlite3.test.regression.UnhashableCallbacksTestCase('test_authorizer'), + sqlite3.test.regression.UnhashableCallbacksTestCase('test_aggr'), + 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 += [ sqlite3.test.transactions.TransactionTests('CheckLocking'), diff --git a/tests/suite/test_ssl_stdlib.py b/tests/suite/test_ssl_stdlib.py index 4f99fc8e4..1cc64beb6 100644 --- a/tests/suite/test_ssl_stdlib.py +++ b/tests/suite/test_ssl_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_ssl from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono, is_osx, is_posix import test.test_ssl def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_ssl) + tests = loader.loadTestsFromModule(test.test_ssl, pattern=pattern) if is_ironpython: failing_tests = [ @@ -35,50 +37,56 @@ def load_tests(loader, standard_tests, pattern): test.test_ssl.ContextTests('test_sni_callback'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' test.test_ssl.ContextTests('test_sni_callback_refcycle'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' test.test_ssl.ContextTests('test_verify_mode'), # AssertionError: ValueError 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 - test.test_ssl.NetworkedTests('test_connect_with_context'), # AssertionError: {} != None - test.test_ssl.NetworkedTests('test_context_setget'), # AttributeError: can't assign to read-only property context of type '_SSLSocket' - test.test_ssl.NetworkedTests('test_get_ca_certs_capath'), # AttributeError: 'SSLContext' object has no attribute 'get_ca_certs' - test.test_ssl.NetworkedTests('test_non_blocking_connect_ex'), # OSError: [Errno -2146232800] The operation is not allowed on a non-blocking Socket. test.test_ssl.SSLErrorTests('test_lib_reason'), # AttributeError: 'SSLContext' object has no attribute 'load_dh_params' test.test_ssl.SSLErrorTests('test_str'), # AssertionError: '[Errno 1] foo' != 'foo' test.test_ssl.ThreadedTests('test_dh_params'), # AttributeError: 'SSLContext' object has no attribute 'load_dh_params' - test.test_ssl.ThreadedTests('test_empty_cert'), # NotImplementedError: keyfile - test.test_ssl.ThreadedTests('test_malformed_cert'), # NotImplementedError: keyfile - test.test_ssl.ThreadedTests('test_malformed_key'), # NotImplementedError: keyfile - test.test_ssl.ThreadedTests('test_nonexisting_cert'), # NotImplementedError: keyfile - test.test_ssl.ThreadedTests('test_recv_send'), # NotImplementedError: keyfile test.test_ssl.ThreadedTests('test_sni_callback'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' test.test_ssl.ThreadedTests('test_sni_callback_alert'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' test.test_ssl.ThreadedTests('test_sni_callback_raising'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' test.test_ssl.ThreadedTests('test_sni_callback_wrong_return_type'), # AttributeError: 'SSLContext' object has no attribute 'set_servername_callback' - ] - if is_posix: + if sys.version_info < (3, 6): failing_tests += [ - test.test_ssl.ContextTests('test_load_default_certs_env'), # 'SSLContext' object has no attribute 'cert_store_stats' - test.test_ssl.NetworkedTests('test_makefile_close'), # OSError: [Errno 9] Bad file descriptor + 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 + test.test_ssl.NetworkedTests('test_connect_with_context'), # AssertionError: {} != None + test.test_ssl.NetworkedTests('test_context_setget'), # AttributeError: can't assign to read-only property context of type '_SSLSocket' + test.test_ssl.NetworkedTests('test_get_ca_certs_capath'), # AttributeError: 'SSLContext' object has no attribute 'get_ca_certs' + test.test_ssl.NetworkedTests('test_non_blocking_connect_ex'), # OSError: [Errno -2146232800] The operation is not allowed on a non-blocking Socket. + test.test_ssl.ThreadedTests('test_empty_cert'), # NotImplementedError: keyfile + test.test_ssl.ThreadedTests('test_malformed_cert'), # NotImplementedError: keyfile + test.test_ssl.ThreadedTests('test_malformed_key'), # NotImplementedError: keyfile + test.test_ssl.ThreadedTests('test_nonexisting_cert'), # NotImplementedError: keyfile + test.test_ssl.ThreadedTests('test_recv_send'), # NotImplementedError: keyfile + ] + if is_posix: + failing_tests += [ + test.test_ssl.NetworkedTests('test_makefile_close'), # OSError: [Errno 9] Bad file descriptor + ] + if is_mono and is_osx: + failing_tests += [ + test.test_ssl.NetworkedTests('test_connect_cadata'), # # https://github.com/IronLanguages/ironpython3/issues/1523 + test.test_ssl.NetworkedTests('test_connect_ex'), # https://github.com/IronLanguages/ironpython3/issues/1523 + test.test_ssl.NetworkedTests('test_get_server_certificate'), # https://github.com/IronLanguages/ironpython3/issues/1523 + ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_ssl.BasicSocketTests('test_errors_sslwrap'), # NotImplementedError: keyfile + test.test_ssl.BasicSocketTests('test_parse_all_sans'), # AssertionError ] - if is_mono and is_osx: + if is_posix: failing_tests += [ - test.test_ssl.NetworkedTests('test_connect_cadata'), # # https://github.com/IronLanguages/ironpython3/issues/1523 - test.test_ssl.NetworkedTests('test_connect_ex'), # https://github.com/IronLanguages/ironpython3/issues/1523 - test.test_ssl.NetworkedTests('test_get_server_certificate'), # https://github.com/IronLanguages/ironpython3/issues/1523 + test.test_ssl.ContextTests('test_load_default_certs_env'), # 'SSLContext' object has no attribute 'cert_store_stats' ] skip_tests = [ - test.test_ssl.NetworkedTests('test_connect_ex_error'), # slow - test.test_ssl.SSLErrorTests('test_subclass'), # blocking test.test_ssl.ThreadedTests('test_asyncore_server'), # blocking test.test_ssl.ThreadedTests('test_check_hostname'), test.test_ssl.ThreadedTests('test_compression'), - test.test_ssl.ThreadedTests('test_default_ciphers'), test.test_ssl.ThreadedTests('test_default_ecdh_curve'), test.test_ssl.ThreadedTests('test_echo'), test.test_ssl.ThreadedTests('test_getpeercert'), # blocking - test.test_ssl.ThreadedTests('test_handshake_timeout'), # blocking test.test_ssl.ThreadedTests('test_protocol_sslv2'), test.test_ssl.ThreadedTests('test_protocol_sslv23'), test.test_ssl.ThreadedTests('test_protocol_sslv3'), @@ -91,6 +99,49 @@ def load_tests(loader, standard_tests, pattern): test.test_ssl.ThreadedTests('test_socketserver'), test.test_ssl.ThreadedTests('test_starttls'), # blocking ] + if sys.version_info < (3, 6): + skip_tests += [ + test.test_ssl.NetworkedTests('test_connect_ex_error'), # slow + test.test_ssl.SSLErrorTests('test_subclass'), # blocking + test.test_ssl.ThreadedTests('test_default_ciphers'), + test.test_ssl.ThreadedTests('test_handshake_timeout'), # blocking + ] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_ssl.SSLErrorTests('test_subclass'), # hangs indefinitely: wrapped SSLSocket resets timeout to None + test.test_ssl.SimpleBackgroundTests('test_bio_handshake'), + test.test_ssl.SimpleBackgroundTests('test_bio_read_write_data'), + test.test_ssl.SimpleBackgroundTests('test_ciphers'), + test.test_ssl.SimpleBackgroundTests('test_connect'), + test.test_ssl.SimpleBackgroundTests('test_connect_cadata'), + test.test_ssl.SimpleBackgroundTests('test_connect_capath'), + test.test_ssl.SimpleBackgroundTests('test_connect_ex'), + test.test_ssl.SimpleBackgroundTests('test_connect_fail'), + test.test_ssl.SimpleBackgroundTests('test_connect_with_context'), + test.test_ssl.SimpleBackgroundTests('test_connect_with_context_fail'), + test.test_ssl.SimpleBackgroundTests('test_context_setget'), + test.test_ssl.SimpleBackgroundTests('test_get_ca_certs_capath'), + test.test_ssl.SimpleBackgroundTests('test_get_server_certificate'), + test.test_ssl.SimpleBackgroundTests('test_get_server_certificate_fail'), + test.test_ssl.SimpleBackgroundTests('test_makefile_close'), + test.test_ssl.SimpleBackgroundTests('test_non_blocking_connect_ex'), + test.test_ssl.SimpleBackgroundTests('test_non_blocking_handshake'), + test.test_ssl.ThreadedTests('test_alpn_protocols'), + test.test_ssl.ThreadedTests('test_handshake_timeout'), # hangs indefinitely: wrapped SSLSocket resets timeout to None + test.test_ssl.ThreadedTests('test_no_shared_ciphers'), + test.test_ssl.ThreadedTests('test_nonblocking_send'), + test.test_ssl.ThreadedTests('test_npn_protocols'), + test.test_ssl.ThreadedTests('test_recv_send'), # NotImplementedError: keyfile + test.test_ssl.ThreadedTests('test_recv_zero'), + test.test_ssl.ThreadedTests('test_selected_alpn_protocol'), + test.test_ssl.ThreadedTests('test_selected_alpn_protocol_if_server_uses_alpn'), + test.test_ssl.ThreadedTests('test_sendfile'), + test.test_ssl.ThreadedTests('test_session'), + test.test_ssl.ThreadedTests('test_session_handling'), + test.test_ssl.ThreadedTests('test_shared_ciphers'), + test.test_ssl.ThreadedTests('test_version_basic'), + test.test_ssl.ThreadedTests('test_wrong_cert'), + ] return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_str.py b/tests/suite/test_str.py index 102a17b76..251f6b048 100644 --- a/tests/suite/test_str.py +++ b/tests/suite/test_str.py @@ -499,7 +499,10 @@ def __getitem__(self, idx): for t in (dict, indexable): self.assertEqual(u"abcd".translate(t({})), u"abcd") self.assertEqual(u"abcd".translate(t({ord('a') : ord('A'), ord('b') : None, ord('d') : u"XY"})) , "AcXY") - self.assertRaisesMessage(TypeError, "character mapping must be in range(0x10000)", lambda: 'a'.translate(t({ord('a') : 65536}))) + if sys.version_info >= (3, 6): + self.assertRaisesMessage(ValueError, "character mapping must be in range(0x10000)", lambda: 'a'.translate(t({ord('a') : sys.maxunicode + 1}))) + else: + self.assertRaisesMessage(TypeError, "character mapping must be in range(0x10000)", lambda: 'a'.translate(t({ord('a') : 65536}))) self.assertRaisesMessage(TypeError, "character mapping must return integer, None or str", lambda: 'a'.translate(t({ord('a') : 2.0}))) class ThrowingIndexable: diff --git a/tests/suite/test_string_literals_stdlib.py b/tests/suite/test_string_literals_stdlib.py new file mode 100644 index 000000000..3b351e60f --- /dev/null +++ b/tests/suite/test_string_literals_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_string_literals from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +if sys.version_info >= (3, 6): + import test.test_string_literals + +def load_tests(loader, standard_tests, pattern): + if sys.version_info < (3, 6): + return standard_tests + + tests = loader.loadTestsFromModule(test.test_string_literals, pattern=pattern) + + if is_ironpython: + failing_tests = [ + test.test_string_literals.TestLiterals('test_eval_bytes_invalid_escape'), # https://github.com/IronLanguages/ironpython3/issues/1343 + test.test_string_literals.TestLiterals('test_eval_str_invalid_escape'), # https://github.com/IronLanguages/ironpython3/issues/1343 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_strptime_stdlib.py b/tests/suite/test_strptime_stdlib.py new file mode 100644 index 000000000..312a11b94 --- /dev/null +++ b/tests/suite/test_strptime_stdlib.py @@ -0,0 +1,34 @@ +# 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_strptime from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_strptime + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_strptime, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_strptime.CalculationTests('test_week_of_year_and_day_of_week_calculation'), # TODO: figure out + test.test_strptime.StrptimeTests('test_weekday'), # TODO: figure out + test.test_strptime.TimeRETests('test_compile'), + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_struct_stdlib.py b/tests/suite/test_struct_stdlib.py index 56d99128d..fa9dc43d8 100644 --- a/tests/suite/test_struct_stdlib.py +++ b/tests/suite/test_struct_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_struct from StdLib ## -from iptest import is_ironpython, generate_suite, run_test +import sys + +from iptest import is_ironpython, generate_suite, run_test, net_version import test.test_struct def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_struct) + tests = loader.loadTestsFromModule(test.test_struct, pattern=pattern) if is_ironpython: failing_tests = [ @@ -19,8 +21,15 @@ def load_tests(loader, standard_tests, pattern): test.test_struct.StructTest('test_calcsize'), # AssertionError: 4 not greater than or equal to 8 test.test_struct.StructTest('test_count_overflow'), # AssertionError: error not raised by calcsize ] + if sys.version_info >= (3, 6): + if net_version < (6, 0): + failing_tests += [ + test.test_struct.UnpackIteratorTest('test_half_float'), # https://github.com/IronLanguages/ironpython3/issues/1458 + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_structures_ctypes_stdlib.py b/tests/suite/test_structures_ctypes_stdlib.py new file mode 100644 index 000000000..f33a2cc86 --- /dev/null +++ b/tests/suite/test_structures_ctypes_stdlib.py @@ -0,0 +1,34 @@ +# 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_structures from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import ctypes.test.test_structures + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(ctypes.test.test_structures, pattern=pattern) + + if is_ironpython: + failing_tests = [ + ] + if sys.version_info >= (3, 6): + failing_tests += [ + ctypes.test.test_structures.StructureTestCase('test_conflicting_initializers'), # AssertionError + ctypes.test.test_structures.StructureTestCase('test_pass_by_value_in_register'), # NotImplementedError: in dll + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_super_stdlib.py b/tests/suite/test_super_stdlib.py new file mode 100644 index 000000000..e6f87edab --- /dev/null +++ b/tests/suite/test_super_stdlib.py @@ -0,0 +1,32 @@ +# 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_super from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_super + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_super, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_super.TestSuper('test___class___mro'), # NotImplementedError: Overriding type.mro is not implemented + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_support_stdlib.py b/tests/suite/test_support_stdlib.py new file mode 100644 index 000000000..c03791c46 --- /dev/null +++ b/tests/suite/test_support_stdlib.py @@ -0,0 +1,37 @@ +# 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_support from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test, is_osx + +import test.test_support + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_support, pattern=pattern) + + if is_ironpython: + failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_support.TestSupport('test_args_from_interpreter_flags'), # https://github.com/IronLanguages/ironpython3/issues/1541 + test.test_support.TestSupport('test_optim_args_from_interpreter_flags'), # https://github.com/IronLanguages/ironpython3/issues/1541 + ] + if is_osx: + failing_tests += [ + test.test_support.TestSupport('test_change_cwd'), # https://github.com/IronLanguages/ironpython3/issues/1543 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_sys_stdlib.py b/tests/suite/test_sys_stdlib.py index 325848670..c39688224 100644 --- a/tests/suite/test_sys_stdlib.py +++ b/tests/suite/test_sys_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_sys from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_mono import test.test_sys def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_sys) + tests = loader.loadTestsFromModule(test.test_sys, pattern=pattern) if is_ironpython: failing_tests = [ @@ -20,6 +22,12 @@ def load_tests(loader, standard_tests, pattern): test.test_sys.SysModuleTest('test_setcheckinterval'), # NotImplementedError: IronPython does not support sys.getcheckinterval test.test_sys.SysModuleTest('test_switchinterval'), # AttributeError: 'module' object has no attribute 'setswitchinterval' ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_sys.SysModuleTest('test_c_locale_surrogateescape'), # AssertionError + test.test_sys.SysModuleTest('test_is_finalizing'), # AttributeError: 'module' object has no attribute 'is_finalizing' + test.test_sys.SysModuleTest('test_sys_tracebacklimit'), # AssertionError + ] skip_tests = [ test.test_sys.SysModuleTest('test_43581'), # TODO: figure out - failing in CI diff --git a/tests/suite/test_threading_stdlib.py b/tests/suite/test_threading_stdlib.py index 459c219d1..2a27284ad 100644 --- a/tests/suite/test_threading_stdlib.py +++ b/tests/suite/test_threading_stdlib.py @@ -6,15 +6,28 @@ ## Run selected tests from test_threading from StdLib ## +import sys + from iptest import is_ironpython, is_mono, generate_suite, run_test import test.test_threading def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_threading) + tests = loader.loadTestsFromModule(test.test_threading, pattern=pattern) if is_ironpython: failing_tests = [] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_threading.CRLockTests('test_weakref_deleted'), # TypeError: cannot create weak reference to 'RLock' object + test.test_threading.CRLockTests('test_weakref_exists'), # TypeError: cannot create weak reference to 'RLock' object + test.test_threading.LockTests('test_weakref_deleted'), # TypeError: cannot create weak reference to 'lock' object + test.test_threading.LockTests('test_weakref_exists'), # TypeError: cannot create weak reference to 'lock' object + test.test_threading.ConditionAsRLockTests('test_weakref_deleted'), # AssertionError + test.test_threading.PyRLockTests('test_weakref_deleted'), # AssertionError + test.test_threading.ThreadTests('test_main_thread_during_shutdown'), # AssertionError + test.test_threading.ThreadingExceptionTests('test_bare_raise_in_brand_new_thread'), # AssertionError: TypeError('exceptions must derive from BaseException',) is not an instance of + ] skip_tests = [ test.test_threading.SubinterpThreadingTests('test_threads_join'), # ImportError: No module named '_testcapi' diff --git a/tests/suite/test_time_stdlib.py b/tests/suite/test_time_stdlib.py index aa2f6c30c..25eb6e75c 100644 --- a/tests/suite/test_time_stdlib.py +++ b/tests/suite/test_time_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_time from StdLib ## +import sys + from iptest import is_ironpython, is_osx, is_netcoreapp21, generate_suite, run_test import test.test_time def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_time) + tests = loader.loadTestsFromModule(test.test_time, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_tuple.py b/tests/suite/test_tuple.py index 61d73a2b7..e8e0546d4 100644 --- a/tests/suite/test_tuple.py +++ b/tests/suite/test_tuple.py @@ -2,6 +2,7 @@ # 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. +import sys import unittest from iptest import IronPythonTestCase, big, run_test, skipUnlessIronPython @@ -9,11 +10,16 @@ class TupleTest(IronPythonTestCase): def test_assign_to_empty(self): - """Disallow assignment to empty tuple""" + """Assignment to empty tuple""" y = () - self.assertRaises(SyntaxError, compile, "() = y", "Error", "exec") - self.assertRaises(SyntaxError, compile, "(), t = y, 0", "Error", "exec") - self.assertRaises(SyntaxError, compile, "((()))=((y))", "Error", "exec") + if sys.version_info >= (3, 6): + exec("() = y") + exec("(), t = y, 0") + exec("((()))=((y))") + else: + self.assertRaises(SyntaxError, compile, "() = y", "Error", "exec") + self.assertRaises(SyntaxError, compile, "(), t = y, 0", "Error", "exec") + self.assertRaises(SyntaxError, compile, "((()))=((y))", "Error", "exec") del y def test_unpack(self): @@ -52,11 +58,11 @@ class mylong(int): pass self.assertEqual((3, 4).__mul__(mylong(2)), (3, 4, 3, 4)) self.assertEqual((5, 6).__rmul__(mylong(2)), (5, 6, 5, 6)) self.assertEqual(mylong(2) * (7,8) , (7, 8, 7, 8)) - + class mylong2(int): def __rmul__(self, other): return 42 - + self.assertEqual((1,2) * mylong2(2), 42) # this one uses __rmul__ self.assertEqual((3, 4).__mul__(mylong2(2)), (3, 4, 3, 4)) self.assertEqual((5, 6).__rmul__(mylong2(2)), (5, 6, 5, 6)) @@ -71,12 +77,12 @@ def __hash__(self): return 42 def __eq__(self, other): return type(self) == type(other) - - + + test = (myhashable(), myhashable(), myhashable()) - + hash(test) - + self.assertEqual(test[0].hashcalls, 1) self.assertEqual(test[1].hashcalls, 1) self.assertEqual(test[2].hashcalls, 1) @@ -94,7 +100,7 @@ def test_tuple_hash_none(self): import clr # Make sure .GetHashCode() is available example = (1, None) expected = 1625286227 - + self.assertEqual(hash(example), expected) self.assertEqual(hash(example), example.GetHashCode()) @@ -103,9 +109,9 @@ def test_tuple_cli_interactions(self): # verify you can call ToString on a tuple after importing clr import clr a = (0,) - + self.assertEqual(str(a), a.ToString()) - + def test_sequence_assign(self): try: @@ -125,7 +131,7 @@ def test_sort(self): def test_indexing(self): t = (2,3,4) self.assertRaises(TypeError, lambda : t[2.0]) - + class mytuple(tuple): def __getitem__(self, index): return tuple.__getitem__(self, int(index)) @@ -145,11 +151,11 @@ def __getitem__(self): for x in T((1,)): self.assertEqual(x, 1) - + def test_mul_subclass(self): class subclass(tuple): pass - + u = subclass([0,1]) self.assertTrue(u is not u*1) @@ -179,7 +185,7 @@ def test_wacky_contains(self): class x(tuple): def __contains__(self, other): return retval - + self.assertEqual('abc' in x(), False) class x2(tuple): @@ -191,10 +197,10 @@ def test_tuple_equality(self): class x(object): def __eq__(self, other): return False def __ne__(self, other): return True - + a = x() self.assertEqual((a, ), (a, )) - + def test_tuple_reuse(self): t = (2,4,6) self.assertEqual(id(t), id(tuple(t))) @@ -206,9 +212,8 @@ def test_index_error(self): x = () def delindex(): del x[42] def setindex(): x[42] = 42 - + self.assertRaisesMessage(TypeError, "'tuple' object doesn't support item deletion", delindex) self.assertRaisesMessage(TypeError, "'tuple' object does not support item assignment", setindex) - -run_test(__name__) \ No newline at end of file +run_test(__name__) diff --git a/tests/suite/test_types_stdlib.py b/tests/suite/test_types_stdlib.py index 45302c37a..269eeafd0 100644 --- a/tests/suite/test_types_stdlib.py +++ b/tests/suite/test_types_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_types from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_types def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_types) + tests = loader.loadTestsFromModule(test.test_types, pattern=pattern) if is_ironpython: failing_tests = [ @@ -24,8 +26,18 @@ def load_tests(loader, standard_tests, pattern): test.test_types.TypesTests('test_float__format__'), # AssertionError: '1.12339e+200' != '1.1234e+200' test.test_types.TypesTests('test_internal_sizes'), # AttributeError: 'type' object has no attribute '__basicsize__' ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_types.ClassCreationTests('test_bad___prepare__'), # AssertionError + test.test_types.ClassCreationTests('test_one_argument_type'), # AssertionError: TypeError not raised + test.test_types.CoroutineTests('test_gen'), # https://github.com/IronLanguages/ironpython3/issues/98 + test.test_types.CoroutineTests('test_genfunc'), # https://github.com/IronLanguages/ironpython3/issues/98 + test.test_types.CoroutineTests('test_returning_itercoro'), # https://github.com/IronLanguages/ironpython3/issues/98 + ] + + skip_tests = [] - return generate_suite(tests, failing_tests) + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_typing_stdlib.py b/tests/suite/test_typing_stdlib.py index a8a2c01c3..890d6a63f 100644 --- a/tests/suite/test_typing_stdlib.py +++ b/tests/suite/test_typing_stdlib.py @@ -6,241 +6,16 @@ ## Run selected tests from test_typing from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_typing def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_typing) + tests = loader.loadTestsFromModule(test.test_typing, pattern=pattern) if is_ironpython: - test.test_typing.AllTests('test_all') - - test.test_typing.AnyTests('test_any_instance_type_error') - test.test_typing.AnyTests('test_any_subclass_type_error') - test.test_typing.AnyTests('test_any_works_with_alias') - test.test_typing.AnyTests('test_cannot_instantiate') - test.test_typing.AnyTests('test_cannot_subclass') - test.test_typing.AnyTests('test_errors') - test.test_typing.AnyTests('test_repr') - test.test_typing.CallableTests('test_callable_instance_type_error') - test.test_typing.CallableTests('test_callable_instance_works') - test.test_typing.CallableTests('test_callable_with_ellipsis') - test.test_typing.CallableTests('test_callable_wrong_forms') - test.test_typing.CallableTests('test_cannot_instantiate') - test.test_typing.CallableTests('test_ellipsis_in_generic') - test.test_typing.CallableTests('test_eq_hash') - test.test_typing.CallableTests('test_repr') - test.test_typing.CallableTests('test_self_subclass') - test.test_typing.CastTests('test_basics') - test.test_typing.CastTests('test_errors') - test.test_typing.ClassVarTests('test_basics') - test.test_typing.ClassVarTests('test_cannot_init') - test.test_typing.ClassVarTests('test_cannot_subclass') - test.test_typing.ClassVarTests('test_no_isinstance') - test.test_typing.ClassVarTests('test_repr') - test.test_typing.CollectionsAbcTests('test_abstractset') - test.test_typing.CollectionsAbcTests('test_async_generator') - test.test_typing.CollectionsAbcTests('test_async_iterable') - test.test_typing.CollectionsAbcTests('test_async_iterator') - test.test_typing.CollectionsAbcTests('test_awaitable') - test.test_typing.CollectionsAbcTests('test_bytestring') - test.test_typing.CollectionsAbcTests('test_chainmap_subclass') - test.test_typing.CollectionsAbcTests('test_collection') - test.test_typing.CollectionsAbcTests('test_collections_as_base') - test.test_typing.CollectionsAbcTests('test_container') - test.test_typing.CollectionsAbcTests('test_coroutine') - test.test_typing.CollectionsAbcTests('test_counter') - test.test_typing.CollectionsAbcTests('test_counter_subclass_instantiation') - - test.test_typing.CollectionsAbcTests('test_defaultdict_subclass') - test.test_typing.CollectionsAbcTests('test_deque') - - test.test_typing.CollectionsAbcTests('test_dict') - test.test_typing.CollectionsAbcTests('test_dict_subclass') - test.test_typing.CollectionsAbcTests('test_frozenset') - test.test_typing.CollectionsAbcTests('test_frozenset_subclass_instantiation') - test.test_typing.CollectionsAbcTests('test_generator') - test.test_typing.CollectionsAbcTests('test_hashable') - test.test_typing.CollectionsAbcTests('test_iterable') - test.test_typing.CollectionsAbcTests('test_iterator') - test.test_typing.CollectionsAbcTests('test_list') - test.test_typing.CollectionsAbcTests('test_list_subclass') - test.test_typing.CollectionsAbcTests('test_mapping') - test.test_typing.CollectionsAbcTests('test_mutablemapping') - test.test_typing.CollectionsAbcTests('test_mutablesequence') - test.test_typing.CollectionsAbcTests('test_mutableset') - test.test_typing.CollectionsAbcTests('test_no_async_generator_instantiation') - test.test_typing.CollectionsAbcTests('test_no_dict_instantiation') - test.test_typing.CollectionsAbcTests('test_no_frozenset_instantiation') - test.test_typing.CollectionsAbcTests('test_no_generator_instantiation') - test.test_typing.CollectionsAbcTests('test_no_list_instantiation') - test.test_typing.CollectionsAbcTests('test_no_set_instantiation') - test.test_typing.CollectionsAbcTests('test_no_tuple_instantiation') - test.test_typing.CollectionsAbcTests('test_sequence') - test.test_typing.CollectionsAbcTests('test_set') - test.test_typing.CollectionsAbcTests('test_set_subclass_instantiation') - test.test_typing.CollectionsAbcTests('test_sized') - - test.test_typing.CollectionsAbcTests('test_subclassing_async_generator') - test.test_typing.CollectionsAbcTests('test_subclassing_register') - test.test_typing.CollectionsAbcTests('test_subclassing_subclasshook') - test.test_typing.ForwardRefTests('test_basics') - test.test_typing.ForwardRefTests('test_callable_forward') - test.test_typing.ForwardRefTests('test_callable_with_ellipsis_forward') - test.test_typing.ForwardRefTests('test_default_globals') - test.test_typing.ForwardRefTests('test_delayed_syntax_error') - test.test_typing.ForwardRefTests('test_forward_equality') - test.test_typing.ForwardRefTests('test_forward_equality_gth') - test.test_typing.ForwardRefTests('test_forward_equality_hash') - test.test_typing.ForwardRefTests('test_forward_equality_namespace') - test.test_typing.ForwardRefTests('test_forward_recursion_actually') - test.test_typing.ForwardRefTests('test_forward_repr') - test.test_typing.ForwardRefTests('test_forwardref_instance_type_error') - test.test_typing.ForwardRefTests('test_forwardref_subclass_type_error') - test.test_typing.ForwardRefTests('test_meta_no_type_check') - test.test_typing.ForwardRefTests('test_name_error') - test.test_typing.ForwardRefTests('test_no_type_check') - test.test_typing.ForwardRefTests('test_no_type_check_class') - test.test_typing.ForwardRefTests('test_no_type_check_no_bases') - test.test_typing.ForwardRefTests('test_syntax_error') - test.test_typing.ForwardRefTests('test_tuple_forward') - test.test_typing.ForwardRefTests('test_type_error') - test.test_typing.ForwardRefTests('test_union_forward') - test.test_typing.ForwardRefTests('test_union_forward_recursion') - test.test_typing.GenericTests('test_abc_bases') - test.test_typing.GenericTests('test_abc_registry_kept') - test.test_typing.GenericTests('test_all_repr_eq_any') - test.test_typing.GenericTests('test_basics') - test.test_typing.GenericTests('test_chain_repr') - test.test_typing.GenericTests('test_copy_and_deepcopy') - - test.test_typing.GenericTests('test_dict') - test.test_typing.GenericTests('test_eq_1') - test.test_typing.GenericTests('test_eq_2') - test.test_typing.GenericTests('test_errors') - test.test_typing.GenericTests('test_extended_generic_rules_eq') - test.test_typing.GenericTests('test_extended_generic_rules_repr') - test.test_typing.GenericTests('test_extended_generic_rules_subclassing') - test.test_typing.GenericTests('test_fail_with_bare_generic') - test.test_typing.GenericTests('test_fail_with_bare_union') - test.test_typing.GenericTests('test_false_subclasses') - test.test_typing.GenericTests('test_generic_errors') - test.test_typing.GenericTests('test_generic_forward_ref') - test.test_typing.GenericTests('test_implicit_any') - test.test_typing.GenericTests('test_init') - test.test_typing.GenericTests('test_init_subclass') - test.test_typing.GenericTests('test_multi_subscr_base') - test.test_typing.GenericTests('test_multiple_bases') - test.test_typing.GenericTests('test_multiple_inheritance') - - test.test_typing.GenericTests('test_nested') - test.test_typing.GenericTests('test_new_no_args') - test.test_typing.GenericTests('test_new_repr') - test.test_typing.GenericTests('test_new_repr_bare') - test.test_typing.GenericTests('test_new_repr_complex') - test.test_typing.GenericTests('test_new_with_args') - test.test_typing.GenericTests('test_new_with_args2') - test.test_typing.GenericTests('test_orig_bases') - - - test.test_typing.GenericTests('test_pickle') - test.test_typing.GenericTests('test_repr') - test.test_typing.GenericTests('test_subscript_meta') - - - - - test.test_typing.GenericTests('test_weakref_all') - test.test_typing.GetTypeHintTests('test_get_type_hints_ClassVar') - test.test_typing.GetTypeHintTests('test_get_type_hints_classes') - test.test_typing.GetTypeHintTests('test_get_type_hints_for_builtins') - test.test_typing.GetTypeHintTests('test_get_type_hints_for_object_with_annotations') - test.test_typing.GetTypeHintTests('test_get_type_hints_from_various_objects') - test.test_typing.GetTypeHintTests('test_get_type_hints_modules') - test.test_typing.GetTypeHintTests('test_get_type_hints_modules_forwardref') - test.test_typing.GetTypeHintTests('test_previous_behavior') - test.test_typing.GetTypeHintTests('test_respect_no_type_check') - test.test_typing.IOTests('test_binaryio') - test.test_typing.IOTests('test_io') - - test.test_typing.IOTests('test_textio') - test.test_typing.NamedTupleTests('test_annotation_usage') - test.test_typing.NamedTupleTests('test_annotation_usage_with_default') - test.test_typing.NamedTupleTests('test_annotation_usage_with_methods') - test.test_typing.NamedTupleTests('test_basics') - test.test_typing.NamedTupleTests('test_namedtuple_errors') - test.test_typing.NamedTupleTests('test_namedtuple_keyword_usage') - test.test_typing.NamedTupleTests('test_namedtuple_pyversion') - test.test_typing.NamedTupleTests('test_namedtuple_special_keyword_names') - test.test_typing.NamedTupleTests('test_pickle') - test.test_typing.NewTypeTests('test_basic') - test.test_typing.NewTypeTests('test_errors') - test.test_typing.NoReturnTests('test_cannot_instantiate') - test.test_typing.NoReturnTests('test_cannot_subclass') - test.test_typing.NoReturnTests('test_noreturn_instance_type_error') - test.test_typing.NoReturnTests('test_noreturn_subclass_type_error') - test.test_typing.NoReturnTests('test_not_generic') - test.test_typing.NoReturnTests('test_repr') - test.test_typing.OtherABCTests('test_async_contextmanager') - test.test_typing.OtherABCTests('test_contextmanager') - test.test_typing.OverloadTests('test_overload_fails') - test.test_typing.OverloadTests('test_overload_succeeds') - test.test_typing.ProtocolTests('test_protocol_instance_type_error') - test.test_typing.ProtocolTests('test_reversible') - test.test_typing.ProtocolTests('test_supports_abs') - test.test_typing.ProtocolTests('test_supports_bytes') - test.test_typing.ProtocolTests('test_supports_complex') - test.test_typing.ProtocolTests('test_supports_float') - test.test_typing.ProtocolTests('test_supports_index') - test.test_typing.ProtocolTests('test_supports_int') - test.test_typing.ProtocolTests('test_supports_round') - test.test_typing.RETests('test_alias_equality') - test.test_typing.RETests('test_errors') - test.test_typing.RETests('test_repr') - test.test_typing.TupleTests('test_basics') - test.test_typing.TupleTests('test_equality') - test.test_typing.TupleTests('test_errors') - test.test_typing.TupleTests('test_repr') - test.test_typing.TupleTests('test_tuple_instance_type_error') - test.test_typing.TupleTests('test_tuple_subclass') - test.test_typing.TypeTests('test_type_basic') - test.test_typing.TypeTests('test_type_optional') - test.test_typing.TypeTests('test_type_typevar') - test.test_typing.TypeVarTests('test_basic_plain') - test.test_typing.TypeVarTests('test_bound_errors') - test.test_typing.TypeVarTests('test_cannot_instantiate_vars') - test.test_typing.TypeVarTests('test_cannot_subclass_var_itself') - test.test_typing.TypeVarTests('test_cannot_subclass_vars') - test.test_typing.TypeVarTests('test_constrained_error') - test.test_typing.TypeVarTests('test_no_bivariant') - test.test_typing.TypeVarTests('test_no_redefinition') - test.test_typing.TypeVarTests('test_repr') - test.test_typing.TypeVarTests('test_typevar_instance_type_error') - test.test_typing.TypeVarTests('test_typevar_subclass_type_error') - test.test_typing.TypeVarTests('test_union_constrained') - test.test_typing.TypeVarTests('test_union_unique') - test.test_typing.UnionTests('test_base_class_disappears') - test.test_typing.UnionTests('test_basics') - test.test_typing.UnionTests('test_cannot_instantiate') - test.test_typing.UnionTests('test_cannot_subclass') - test.test_typing.UnionTests('test_empty') - test.test_typing.UnionTests('test_etree') - test.test_typing.UnionTests('test_function_repr_union') - test.test_typing.UnionTests('test_no_eval_union') - test.test_typing.UnionTests('test_optional') - test.test_typing.UnionTests('test_repr') - test.test_typing.UnionTests('test_single_class_disappears') - test.test_typing.UnionTests('test_subclass_error') - test.test_typing.UnionTests('test_union_any') - test.test_typing.UnionTests('test_union_compare_other') - test.test_typing.UnionTests('test_union_generalization') - test.test_typing.UnionTests('test_union_instance_type_error') - test.test_typing.UnionTests('test_union_object') - test.test_typing.UnionTests('test_union_str_pattern') - test.test_typing.UnionTests('test_union_union') - test.test_typing.UnionTests('test_unordered') - failing_tests = [ test.test_typing.GenericTests('test_generic_hashes'), # https://github.com/IronLanguages/ironpython3/issues/30 test.test_typing.GenericTests('test_repr_2'), # https://github.com/IronLanguages/ironpython3/issues/30 @@ -264,8 +39,23 @@ def load_tests(loader, standard_tests, pattern): test.test_typing.GenericTests('test_substitution_helper'), test.test_typing.GenericTests('test_type_erasure'), ] + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_typing.GenericTests('test_init_subclass'), # AttributeError: 'GenericMeta' object has no attribute 'attr' + test.test_typing.GetTypeHintTests('test_get_type_hints_ClassVar'), # AssertionError + test.test_typing.GetTypeHintTests('test_get_type_hints_classes'), # AssertionError + test.test_typing.GetTypeHintTests('test_get_type_hints_modules'), # AssertionError + test.test_typing.NamedTupleTests('test_annotation_usage'), # TypeError: __new__() takes exactly 1 argument (3 given) + test.test_typing.NamedTupleTests('test_annotation_usage_with_default'), # TypeError: __new__() takes exactly 1 argument (2 given) + test.test_typing.NamedTupleTests('test_annotation_usage_with_methods'), # TypeError: __new__() takes exactly 1 argument (2 given) + ] skip_tests = [] + if sys.version_info >= (3, 6): + skip_tests += [ + test.test_typing.NamedTupleTests('test_namedtuple_keyword_usage'), # AssertionError + ] + return generate_suite(tests, failing_tests, skip_tests) diff --git a/tests/suite/test_unicode_stdlib.py b/tests/suite/test_unicode_stdlib.py index 3d0a4b88e..162b4782b 100644 --- a/tests/suite/test_unicode_stdlib.py +++ b/tests/suite/test_unicode_stdlib.py @@ -6,17 +6,17 @@ ## Run selected tests from test_unicode from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_unicode def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_unicode) + tests = loader.loadTestsFromModule(test.test_unicode, pattern=pattern) if is_ironpython: failing_tests = [ - test.test_unicode.UnicodeTest('test_aswidechar'), - test.test_unicode.UnicodeTest('test_aswidecharstring'), test.test_unicode.UnicodeTest('test_capitalize'), test.test_unicode.UnicodeTest('test_case_operation_overflow'), test.test_unicode.UnicodeTest('test_casefold'), @@ -25,7 +25,6 @@ def load_tests(loader, standard_tests, pattern): test.test_unicode.UnicodeTest('test_codecs_utf7'), test.test_unicode.UnicodeTest('test_compare'), test.test_unicode.UnicodeTest('test_constructor_defaults'), - test.test_unicode.UnicodeTest('test_encode_decimal'), test.test_unicode.UnicodeTest('test_expandtabs_optimization'), test.test_unicode.UnicodeTest('test_expandtabs_overflows_gracefully'), test.test_unicode.UnicodeTest('test_format'), @@ -35,7 +34,6 @@ def load_tests(loader, standard_tests, pattern): test.test_unicode.UnicodeTest('test_formatting'), test.test_unicode.UnicodeTest('test_formatting_c_limits'), test.test_unicode.UnicodeTest('test_formatting_huge_precision_c_limits'), - test.test_unicode.UnicodeTest('test_from_format'), test.test_unicode.UnicodeTest('test_getnewargs'), test.test_unicode.UnicodeTest('test_invalid_cb_for_2bytes_seq'), test.test_unicode.UnicodeTest('test_invalid_cb_for_3bytes_seq'), @@ -56,7 +54,6 @@ def load_tests(loader, standard_tests, pattern): test.test_unicode.UnicodeTest('test_lower'), test.test_unicode.UnicodeTest('test_mul'), test.test_unicode.UnicodeTest('test_partition'), - test.test_unicode.UnicodeTest('test_pep393_utf8_caching_bug'), test.test_unicode.UnicodeTest('test_printable_repr'), test.test_unicode.UnicodeTest('test_raiseMemError'), test.test_unicode.UnicodeTest('test_replace'), @@ -64,15 +61,31 @@ def load_tests(loader, standard_tests, pattern): test.test_unicode.UnicodeTest('test_replace_overflow'), test.test_unicode.UnicodeTest('test_rpartition'), test.test_unicode.UnicodeTest('test_rsplit'), - test.test_unicode.UnicodeTest('test_split'), + test.test_unicode.UnicodeTest('test_split'), # https://github.com/IronLanguages/ironpython3/issues/252 test.test_unicode.UnicodeTest('test_swapcase'), test.test_unicode.UnicodeTest('test_title'), - test.test_unicode.UnicodeTest('test_transform_decimal'), test.test_unicode.UnicodeTest('test_unexpected_end_of_data'), test.test_unicode.UnicodeTest('test_upper'), ] - return generate_suite(tests, failing_tests) + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_unicode.UnicodeTest('test_issue28598_strsubclass_rhs'), + test.test_unicode.UnicodeTest('test_join_overflow'), # ValueError: capacity was less than the current size. + ] + else: + failing_tests += [ + test.test_unicode.UnicodeTest('test_aswidechar'), + test.test_unicode.UnicodeTest('test_aswidecharstring'), + test.test_unicode.UnicodeTest('test_encode_decimal'), + test.test_unicode.UnicodeTest('test_from_format'), + test.test_unicode.UnicodeTest('test_pep393_utf8_caching_bug'), + test.test_unicode.UnicodeTest('test_transform_decimal'), + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_userlist_stdlib.py b/tests/suite/test_userlist_stdlib.py new file mode 100644 index 000000000..c58bac6d5 --- /dev/null +++ b/tests/suite/test_userlist_stdlib.py @@ -0,0 +1,33 @@ +# 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_userlist from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +import test.test_userlist + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_userlist, pattern=pattern) + + if is_ironpython: + failing_tests = [] + + if sys.version_info >= (3, 6): + failing_tests += [ + test.test_userlist.UserListTest('test_free_after_iterating'), # https://github.com/IronLanguages/ironpython3/issues/1246 + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/tests/suite/test_utf8_mode_stdlib.py b/tests/suite/test_utf8_mode_stdlib.py index 1a8643684..ab83b327d 100644 --- a/tests/suite/test_utf8_mode_stdlib.py +++ b/tests/suite/test_utf8_mode_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_utf8_mode from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test, is_netcoreapp21, is_windows import test.test_utf8_mode def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_utf8_mode) + tests = loader.loadTestsFromModule(test.test_utf8_mode, pattern=pattern) if is_ironpython: failing_tests = [ diff --git a/tests/suite/test_weakset_stdlib.py b/tests/suite/test_weakset_stdlib.py index c863e9e81..36dc43d34 100644 --- a/tests/suite/test_weakset_stdlib.py +++ b/tests/suite/test_weakset_stdlib.py @@ -6,12 +6,14 @@ ## Run selected tests from test_weakset from StdLib ## +import sys + from iptest import is_ironpython, generate_suite, run_test import test.test_weakset def load_tests(loader, standard_tests, pattern): - tests = loader.loadTestsFromModule(test.test_weakset) + tests = loader.loadTestsFromModule(test.test_weakset, pattern=pattern) if is_ironpython: failing_tests = [ @@ -19,7 +21,9 @@ def load_tests(loader, standard_tests, pattern): test.test_weakset.TestWeakSet('test_weak_destroy_and_mutate_while_iterating'), # TODO: figure out ] - return generate_suite(tests, failing_tests) + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) else: return tests diff --git a/tests/suite/test_yield_from_stdlib.py b/tests/suite/test_yield_from_stdlib.py new file mode 100644 index 000000000..7022f3a7c --- /dev/null +++ b/tests/suite/test_yield_from_stdlib.py @@ -0,0 +1,34 @@ +# 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_pep380 from StdLib +## + +import sys + +from iptest import is_ironpython, generate_suite, run_test + +if sys.version_info >= (3, 6): + import test.yield_from as test_yield_from +else: + import test.test_pep380 as test_yield_from + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test_yield_from, pattern=pattern) + + if is_ironpython: + failing_tests = [ + test_yield_from.TestPEP380Operation('test_broken_getattr_handling'), # TODO: figure out + test_yield_from.TestPEP380Operation('test_catching_exception_from_subgen_and_returning'), # TODO: figure out + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__)