From b3e3c9de597ee69f72d53ce0bf8284e2084054af Mon Sep 17 00:00:00 2001 From: Paul Dorsch <107068277+pauld-msft@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:03:27 -0400 Subject: [PATCH] Pauldorsch/remove pip report throw (#1151) * remove throw for pip report so all pip files will be scanned * fix tests --- .../pip/PipReportComponentDetector.cs | 2 -- .../PipReportComponentDetectorTests.cs | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs b/src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs index 5e074786e..ead2ade5a 100644 --- a/src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs +++ b/src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs @@ -132,8 +132,6 @@ protected override async Task OnFileFoundAsync(ProcessRequest processRequest, ID ExceptionMessage = e.Message, StackTrace = e.StackTrace, }; - - throw; } finally { diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PipReportComponentDetectorTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PipReportComponentDetectorTests.cs index cd6d92630..891dc4d1d 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PipReportComponentDetectorTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PipReportComponentDetectorTests.cs @@ -163,10 +163,11 @@ public async Task TestPipReportDetector_CatchesExceptionAsync() this.pipCommandService.Setup(x => x.GenerateInstallationReportAsync(It.IsAny(), It.IsAny())) .ThrowsAsync(new InvalidCastException()); - var action = async () => await this.DetectorTestUtility + var (result, componentRecorder) = await this.DetectorTestUtility .WithFile("setup.py", string.Empty) .ExecuteDetectorAsync(); - await action.Should().ThrowAsync(); + + result.ResultCode.Should().Be(ProcessingResultCode.Success); this.mockLogger.Verify(x => x.Log( LogLevel.Warning,