Skip to content
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
37 changes: 0 additions & 37 deletions tests/IronPython.Tests/Cases/CommonCases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,42 +36,6 @@ protected int TestImpl(TestInfo testcase) {
return -1;
} finally {
m?.ReleaseMutex();
CleanupTempFiles(testcase);
}
}

/// <summary>
/// Removes @test_*_tmp files/directories left behind by test.support.TESTFN.
/// </summary>
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
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions tests/IronPython.Tests/Cases/IronPythonCasesManifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions tests/suite/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)."""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down