@@ -326,13 +326,14 @@ func CreateTestWatch(t *testing.T, policyName string, watchName, severity xrayUt
326326}
327327
328328func CreateTestProjectInTempDir (t * testing.T , projectPath string ) (string , func ()) {
329- // TODO: We are not using coreTests.CreateTempDirWithCallbackAndAssert(t) since the callback fails to remove the temp dir on Windows.
330- // (Unknown reason, should be investigated)
331- // tempDirPath := t.TempDir()
332- tempDirPath , clean := coreTests .CreateTempDirWithCallbackAndAssert (t )
333- // maskedPath := filepath.Join(tempDirPath, filepath.Base(projectPath))
334- assert .NoError (t , biutils .CopyDir (projectPath , tempDirPath , true , nil ))
335- return tempDirPath , clean
329+ tempDirPath , err := fileutils .CreateTempDir ()
330+ assert .NoError (t , err , "Couldn't create temp dir" )
331+ actualPath := filepath .Join (filepath .Dir (tempDirPath ), filepath .Base (projectPath ))
332+ coreTests .RenamePath (tempDirPath , actualPath , t )
333+ assert .NoError (t , biutils .CopyDir (projectPath , actualPath , true , nil ))
334+ return actualPath , func () {
335+ assert .NoError (t , fileutils .RemoveTempDir (actualPath ), "Couldn't remove temp dir" )
336+ }
336337}
337338
338339func CreateTestProjectEnvAndChdir (t * testing.T , projectPath string ) (string , func ()) {
0 commit comments