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
42 lines (36 loc) · 1.73 KB
/
Copy pathIronPythonCases.cs
File metadata and controls
42 lines (36 loc) · 1.73 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
39
40
41
42
// 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 GetTestSuite().Concat(GetEngScripts()).OrderBy(testcase => testcase.Name);
IEnumerable<TestInfo> GetTestSuite() {
var root = CaseExecuter.FindRoot();
var folder = Path.Combine("tests", "suite");
var fullPath = Path.GetFullPath(Path.Combine(root, folder));
foreach (var filename in Directory.EnumerateFiles(fullPath, "test_*.py", SearchOption.AllDirectories))
yield return new TestInfo(filename, category, folder, manifest);
}
IEnumerable<TestInfo> GetEngScripts() {
var root = CaseExecuter.FindRoot();
var folder = Path.Combine("eng", "scripts");
var filename = Path.GetFullPath(Path.Combine(root, folder, "test_cgcheck.py"));
if (File.Exists(filename)) {
yield return new TestInfo(filename, $"{category}.scripts", folder, manifest);
}
}
}
}
}