Skip to content

Commit 4b0e484

Browse files
Fix parallel mode bug (#125)
Co-authored-by: Jiapeng Xu <jiapengxu@microsoft.com>
1 parent a2d10b4 commit 4b0e484

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/yunit/TestAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrame
139139
foreach (var fileTests in fileSequentialTestsParallelTests.GroupBy(test => test.CodeFilePath))
140140
{
141141
var testRuns = new ConcurrentBag<Task>();
142-
Parallel.ForEach(fileTests.SelectMany(fileTest => fileTests), test => testRuns.Add(RunTest(frameworkHandle, test, inOnlyMode)));
142+
Parallel.ForEach(fileTests.ToArray(), test => testRuns.Add(RunTest(frameworkHandle, test, inOnlyMode)));
143143
Task.WhenAll(testRuns).GetAwaiter().GetResult();
144144
}
145145
}
146146

147147
var fileParallelTestsSequentialTests = groupTests.Where(group => group.Key == ParallelMode.FileParallelTestsSequential).SelectMany(group => group).ToArray();
148-
if (fileSequentialTestsParallelTests.Any())
148+
if (fileParallelTestsSequentialTests.Any())
149149
{
150150
var testRuns = new ConcurrentBag<Task>();
151151
foreach (var fileTests in fileParallelTestsSequentialTests.GroupBy(test => test.CodeFilePath).ToArray())

0 commit comments

Comments
 (0)