diff --git a/tests/IronPython.Tests/Cases/CommonCases.cs b/tests/IronPython.Tests/Cases/CommonCases.cs index d8d5ac163..b8bd7d6c3 100644 --- a/tests/IronPython.Tests/Cases/CommonCases.cs +++ b/tests/IronPython.Tests/Cases/CommonCases.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.IO; using System.Threading; using NUnit.Framework; @@ -37,42 +36,6 @@ protected int TestImpl(TestInfo testcase) { return -1; } finally { m?.ReleaseMutex(); - CleanupTempFiles(testcase); - } - } - - /// - /// Removes @test_*_tmp files/directories left behind by test.support.TESTFN. - /// - private static void CleanupTempFiles(TestInfo testcase) { - var testDir = Path.GetDirectoryName(testcase.Path); - if (testDir is null) return; - - // Clean test directory and also the StdLib test directory - CleanupTempFilesInDir(testDir); - var stdlibTestDir = Path.Combine(CaseExecuter.FindRoot(), "src", "core", "IronPython.StdLib", "lib", "test"); - if (stdlibTestDir != testDir) { - CleanupTempFilesInDir(stdlibTestDir); - } - } - - private static void CleanupTempFilesInDir(string dir) { - if (!Directory.Exists(dir)) return; - - try { - foreach (var entry in Directory.EnumerateFileSystemEntries(dir, "@test_*_tmp*")) { - try { - if (File.GetAttributes(entry).HasFlag(FileAttributes.Directory)) { - Directory.Delete(entry, recursive: true); - } else { - File.Delete(entry); - } - } catch { - // ignore locked/in-use files - } - } - } catch { - // ignore enumeration errors } } } diff --git a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini index c6106d718..07fe270f8 100644 --- a/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini +++ b/tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini @@ -4,9 +4,6 @@ WorkingDirectory=$(TEST_FILE_DIR) Redirect=false Timeout=120000 # 2 minute timeout -[IronPython.test_async] -IsolationLevel=PROCESS # loads IronPythonTest assembly, causes a failure in IronPython.test_attrinjector - [IronPython.test_builtin_stdlib] RunCondition=NOT $(IS_MONO) Reason=Exception on adding DocTestSuite diff --git a/tests/suite/test_async.py b/tests/suite/test_async.py index 93236db82..59ae3500a 100644 --- a/tests/suite/test_async.py +++ b/tests/suite/test_async.py @@ -6,7 +6,8 @@ import unittest -from iptest import run_test +from iptest import run_test, skipUnlessIronPython, is_netcoreapp +from iptest.ipunittest import load_ironpython_test def run_coro(coro): @@ -319,6 +320,7 @@ async def test(): self.assertEqual(run_coro(test()), ['enter', 1, 2, 'exit']) +@skipUnlessIronPython() class DotNetAsyncInteropTest(unittest.TestCase): """Tests for .NET async interop (await Task, async for IAsyncEnumerable, CancelledError).""" @@ -423,6 +425,9 @@ def test_cancellation_token_cancel(self): cts.Cancel() self.assertTrue(token.IsCancellationRequested) + +@unittest.skipUnless(is_netcoreapp, "ValueTask is not available on .NET Framework") +class ValueTaskInteropTest(unittest.TestCase): def test_await_valuetask(self): """await a ValueTask (non-generic).""" from System.Threading.Tasks import ValueTask @@ -464,8 +469,8 @@ async def test(): import sys if sys.implementation.name == 'ironpython': import clr + load_ironpython_test() try: - clr.AddReference('IronPythonTest') from IronPythonTest import AsyncInteropHelpers _has_async_helpers = True except Exception: