Skip to content

Commit fdc35f4

Browse files
committed
Skip test if exception SkipTest is raised
1 parent e06b18a commit fdc35f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/IronPython.Tests/Cases/CaseExecuter.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using IronPython.Hosting;
1818
using IronPython.Runtime;
1919
using IronPython.Runtime.Exceptions;
20+
using IronPython.Runtime.Types;
2021

2122
using Microsoft.Scripting;
2223
using Microsoft.Scripting.Hosting;
@@ -300,6 +301,13 @@ private int GetResult(TestInfo testcase, ScriptEngine engine, ScriptSource sourc
300301
#pragma warning disable SYSLIB0006 // 'Thread.ResetAbort is not supported and throws PlatformNotSupportedException.'
301302
Thread.ResetAbort();
302303
#pragma warning restore SYSLIB0006
304+
} catch (Exception ex) when (ex.GetPythonException() is not null and var pex) {
305+
if (DynamicHelpers.GetPythonType(pex).Name == "SkipTest") {
306+
NUnit.Framework.TestContext.Progress.WriteLine($"Test {testcase.Name} skipped: {pex}");
307+
res = 0;
308+
} else {
309+
throw;
310+
}
303311
}
304312
}, maxStackSize) {
305313
IsBackground = true

0 commit comments

Comments
 (0)