forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPythonCases.cs
More file actions
38 lines (34 loc) · 1.77 KB
/
CPythonCases.cs
File metadata and controls
38 lines (34 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
namespace IronPythonTest.Cases {
[TestFixture(Category = "CPython")]
public class CPythonCases : CommonCases {
[Test, TestCaseSource(typeof(CPythonCaseGenerator))]
public override int Test(TestInfo testcase) {
return TestImpl(testcase);
}
}
internal class CPythonCaseGenerator : CommonCaseGenerator<CPythonCases> {
protected override IEnumerable<TestInfo> GetTests() {
return GetFilenames(new [] {
System.Tuple.Create(category, Path.Combine("Src", "StdLib", "Lib", "test")),
System.Tuple.Create($"{category}.ctypes", Path.Combine("Src", "StdLib", "Lib", "ctypes", "test")),
System.Tuple.Create($"{category}.distutils", Path.Combine("Src", "StdLib", "Lib", "distutils", "tests")),
System.Tuple.Create($"{category}.unittest", Path.Combine("Src", "StdLib", "Lib", "unittest", "test")),
})
.OrderBy(testcase => testcase.Name);
IEnumerable<TestInfo> GetFilenames(IEnumerable<System.Tuple<string, string>> folders) {
foreach (var tuple in folders) {
var fullPath = Path.Combine(CaseExecuter.FindRoot(), tuple.Item2);
foreach (var filename in Directory.EnumerateFiles(fullPath, "test_*.py", SearchOption.AllDirectories))
yield return new TestInfo(Path.GetFullPath(filename), tuple.Item1, tuple.Item2, manifest);
}
}
}
}
}