forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIronPythonCases.cs
More file actions
36 lines (32 loc) · 1.52 KB
/
IronPythonCases.cs
File metadata and controls
36 lines (32 loc) · 1.52 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
// 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 = "IronPython")]
public class IronPythonCases : CommonCases {
[Test, TestCaseSource(typeof(IronPythonCaseGenerator))]
public override int Test(TestInfo testcase) {
return TestImpl(testcase);
}
}
internal class IronPythonCaseGenerator : CommonCaseGenerator<IronPythonCases> {
protected override IEnumerable<TestInfo> GetTests() {
return GetFilenames(new[] {
System.Tuple.Create(category, Path.Combine("Tests")),
System.Tuple.Create($"{category}.scripts", Path.Combine("Src", "Scripts")),
})
.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);
}
}
}
}
}