From fdc35f48e80117b7d2b843d4e9b0037e2f68fc45 Mon Sep 17 00:00:00 2001 From: Pavel Koneski Date: Thu, 30 Jan 2025 15:48:10 -0800 Subject: [PATCH 1/2] Skip test if exception `SkipTest` is raised --- tests/IronPython.Tests/Cases/CaseExecuter.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/IronPython.Tests/Cases/CaseExecuter.cs b/tests/IronPython.Tests/Cases/CaseExecuter.cs index 0af23b672..630f07bd9 100644 --- a/tests/IronPython.Tests/Cases/CaseExecuter.cs +++ b/tests/IronPython.Tests/Cases/CaseExecuter.cs @@ -17,6 +17,7 @@ using IronPython.Hosting; using IronPython.Runtime; using IronPython.Runtime.Exceptions; +using IronPython.Runtime.Types; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; @@ -300,6 +301,13 @@ private int GetResult(TestInfo testcase, ScriptEngine engine, ScriptSource sourc #pragma warning disable SYSLIB0006 // 'Thread.ResetAbort is not supported and throws PlatformNotSupportedException.' Thread.ResetAbort(); #pragma warning restore SYSLIB0006 + } catch (Exception ex) when (ex.GetPythonException() is not null and var pex) { + if (DynamicHelpers.GetPythonType(pex).Name == "SkipTest") { + NUnit.Framework.TestContext.Progress.WriteLine($"Test {testcase.Name} skipped: {pex}"); + res = 0; + } else { + throw; + } } }, maxStackSize) { IsBackground = true From 64c86b6c15d28a2a3cd1a44336ee0f61c6e9e79a Mon Sep 17 00:00:00 2001 From: Pavel Koneski Date: Thu, 30 Jan 2025 19:44:29 -0800 Subject: [PATCH 2/2] "Enable" a few modules that are not available on all platforms --- tests/IronPython.Tests/Cases/CPythonCasesManifest.ini | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini index b3f7c5f00..bbc8afd0f 100644 --- a/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/CPythonCasesManifest.ini @@ -472,10 +472,6 @@ NotParallelSafe=true # Creates/deletes a directory with static name 'xx' [CPython.test_glob] RunCondition=NOT $(IS_POSIX) # TODO: figure out -[CPython.test_grp] -RunCondition=$(IS_POSIX) -Reason=Only valid for Unix - [CPython.test_httplib] # IronPython.test_httplib_stdlib Ignore=true Reason=Blocking @@ -713,7 +709,7 @@ Reason=Blocking [CPython.test_posix] RunCondition=$(IS_POSIX) Ignore=true -Reason=unittest.case.SkipTest: No module named 'posix' +Reason=AttributeError: module 'posix' has no attribute 'chown' [CPython.test_posixpath] Ignore=true @@ -729,10 +725,6 @@ Reason=unittest.case.SkipTest: No module named 'fcntl' [CPython.test_pulldom] Ignore=true -[CPython.test_pwd] -RunCondition=$(IS_POSIX) -Reason=Only valid for Unix - [CPython.test_py_compile] Ignore=true Reason=NotImplementedError: sys.implementation.cache_tag is None