Repository navigation
Expand file tree
/
Copy pathIronPythonCases.cs
More file actions
46 lines (38 loc) · 1.53 KB
/
Copy pathIronPythonCases.cs
File metadata and controls
46 lines (38 loc) · 1.53 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
43
44
45
46
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
namespace IronPythonTest.Cases {
[TestFixture(Category="IronPython")]
public class IronPythonCases {
private CaseExecuter executor;
[OneTimeSetUp]
public void FixtureSetUp() {
this.executor = new CaseExecuter();
}
[Test, TestCaseSource(typeof(IronPythonCaseGenerator))]
public int IronPythonTests(TestInfo testcase) {
try {
Console.Error.WriteLine(testcase.Name); // write to the error stream so it appears before the test is run
return this.executor.RunTest(testcase);
} catch (Exception e) {
Assert.Fail(this.executor.FormatException(e));
return -1;
}
}
}
class IronPythonCaseGenerator : CommonCaseGenerator<IronPythonCases> {
protected override IEnumerable<TestInfo> GetTests() {
return GetFilenames()
.Select(file => new TestInfo(Path.GetFullPath(file), this.manifest))
.OrderBy(testcase => testcase.Name);
IEnumerable<string> GetFilenames() {
var root = CaseExecuter.FindRoot();
foreach (var filename in Directory.EnumerateFiles(Path.Combine(root, "Tests"), "test_*.py", SearchOption.AllDirectories))
yield return filename;
yield return Path.Combine(root, "Src", "Scripts", "test_cgcheck.py");
}
}
}
}