From cb5e553e04bb12f732e90bfd3d77c5949eaafe0e Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Sun, 18 Sep 2022 17:23:34 +0300 Subject: [PATCH] Improve pip test logs (#107) --- build/python_test.go | 17 +++++++++-------- utils/pythonutils/piputils_test.go | 5 +++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build/python_test.go b/build/python_test.go index 4d53b6b7..ca3caa8e 100644 --- a/build/python_test.go +++ b/build/python_test.go @@ -56,13 +56,14 @@ func testGenerateBuildInfoForPython(t *testing.T, pythonTool pythonutils.PythonT pythonModule.SetName(moduleName) assert.NoError(t, pythonModule.RunInstallAndCollectDependencies(cmdArgs)) buildInfo, err := pythonBuild.ToBuildInfo() - assert.NoError(t, err) - // Verify results. - expectedBuildInfoJson := filepath.Join(projectPath, expectedResultsJson) - expectedBuildInfo := testdatautils.GetBuildInfo(t, expectedBuildInfoJson) - match, err := entities.IsEqualModuleSlices(buildInfo.Modules, expectedBuildInfo.Modules) - assert.NoError(t, err) - if !match { - testdatautils.PrintBuildInfoMismatch(t, expectedBuildInfo.Modules, buildInfo.Modules) + if assert.NoError(t, err) { + // Verify results. + expectedBuildInfoJson := filepath.Join(projectPath, expectedResultsJson) + expectedBuildInfo := testdatautils.GetBuildInfo(t, expectedBuildInfoJson) + match, err := entities.IsEqualModuleSlices(buildInfo.Modules, expectedBuildInfo.Modules) + assert.NoError(t, err) + if !match { + testdatautils.PrintBuildInfoMismatch(t, expectedBuildInfo.Modules, buildInfo.Modules) + } } } diff --git a/utils/pythonutils/piputils_test.go b/utils/pythonutils/piputils_test.go index 3ad7995b..5a01d66e 100644 --- a/utils/pythonutils/piputils_test.go +++ b/utils/pythonutils/piputils_test.go @@ -50,8 +50,9 @@ func TestDetermineModuleName(t *testing.T) { // Determine module name packageName, err := getPackageNameFromSetuppy(tmpProjectPath) - assert.NoError(t, err) - assert.Equal(t, test.expectedPackageName, packageName) + if assert.NoError(t, err) { + assert.Equal(t, test.expectedPackageName, packageName) + } }) } }