@@ -19,19 +19,26 @@ public override int Test(TestInfo testcase) {
1919 internal class CPythonCaseGenerator : CommonCaseGenerator < CPythonCases > {
2020 protected override IEnumerable < TestInfo > GetTests ( ) {
2121 var libFolder = Path . Combine ( "src" , "core" , "IronPython.StdLib" , "lib" ) ;
22- return GetFilenames ( new [ ] {
23- System . Tuple . Create ( category , Path . Combine ( libFolder , "test" ) ) ,
24- System . Tuple . Create ( $ "{ category } .ctypes", Path . Combine ( libFolder , "ctypes" , "test" ) ) ,
25- System . Tuple . Create ( $ "{ category } .distutils", Path . Combine ( libFolder , "distutils" , "tests" ) ) ,
26- System . Tuple . Create ( $ "{ category } .unittest", Path . Combine ( libFolder , "unittest" , "test" ) ) ,
27- } )
28- . OrderBy ( testcase => testcase . Name ) ;
22+ var suiteFolder = Path . Combine ( "tests" , "suite" , "stdlib" ) ;
2923
30- IEnumerable < TestInfo > GetFilenames ( IEnumerable < System . Tuple < string , string > > folders ) {
31- foreach ( var tuple in folders ) {
32- var fullPath = Path . Combine ( CaseExecuter . FindRoot ( ) , tuple . Item2 ) ;
33- foreach ( var filename in Directory . EnumerateFiles ( fullPath , "test_*.py" , SearchOption . AllDirectories ) )
34- yield return new TestInfo ( Path . GetFullPath ( filename ) , tuple . Item1 , tuple . Item2 , manifest ) ;
24+ return GetTestInfo ( category , "test" )
25+ . Concat ( GetTestInfo ( $ "{ category } .ctypes", Path . Combine ( "ctypes" , "test" ) ) )
26+ . Concat ( GetTestInfo ( $ "{ category } .distutils", Path . Combine ( "distutils" , "tests" ) ) )
27+ . Concat ( GetTestInfo ( $ "{ category } .unittest", Path . Combine ( "unittest" , "test" ) ) )
28+ . OrderBy ( testcase => testcase . Name ) ;
29+
30+ IEnumerable < TestInfo > GetTestInfo ( string category , string folder ) {
31+ var root = CaseExecuter . FindRoot ( ) ;
32+ var altFolder = Path . GetDirectoryName ( folder ) ; // drop the trailing test (or tests) folder
33+ var fullPath = Path . GetFullPath ( Path . Combine ( root , libFolder , folder ) ) ;
34+ var altFullPath = Path . GetFullPath ( Path . Combine ( root , suiteFolder , altFolder ) ) ;
35+ foreach ( var filename in Directory . EnumerateFiles ( fullPath , "test_*.py" , SearchOption . AllDirectories ) ) {
36+ var altFilename = Path . GetFullPath ( Path . Combine ( altFullPath , Path . GetRelativePath ( fullPath , filename ) ) ) ;
37+ if ( File . Exists ( altFilename ) ) {
38+ yield return new TestInfo ( altFilename , category , Path . Combine ( suiteFolder , altFolder ) , manifest ) ;
39+ } else {
40+ yield return new TestInfo ( filename , category , Path . Combine ( libFolder , folder ) , manifest ) ;
41+ }
3542 }
3643 }
3744 }
0 commit comments