Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip test if exception SkipTest is raised #1895

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions tests/IronPython.Tests/Cases/CPythonCasesManifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/IronPython.Tests/Cases/CaseExecuter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down