From 099f299249b0db3c7e9e9d58754b2425000a6c17 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Thu, 10 Oct 2024 15:27:14 +0200 Subject: [PATCH] bugfix: Don't resolve _ artifact type as it doesn't exist --- project/TestGroups.scala | 1 - .../scalacli/BaseScalaCLIActionSuite.scala | 2 -- .../tests/scalacli/ScalaCliActionsSuite.scala | 4 --- tests/unit/src/main/scala/tests/Library.scala | 2 +- .../codeactions/BaseCodeActionLspSuite.scala | 35 +++++++------------ 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/project/TestGroups.scala b/project/TestGroups.scala index 74668bc76b2..a624a6e9a6e 100644 --- a/project/TestGroups.scala +++ b/project/TestGroups.scala @@ -123,5 +123,4 @@ object TestGroups { "tests.ServerLivenessMonitorSuite", "tests.ResetWorkspaceLspSuite", "tests.ToplevelWithInnerScala3Suite"), ) - } diff --git a/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala b/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala index a18d574f3f9..0a393090de0 100644 --- a/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala +++ b/tests/slow/src/main/scala/tests/scalacli/BaseScalaCLIActionSuite.scala @@ -66,7 +66,6 @@ class BaseScalaCLIActionSuite(name: String) changeFile: String => String = identity, expectError: Boolean = false, filterAction: CodeAction => Boolean = _ => true, - retryAction: Int = 0, )(implicit loc: Location): Unit = { val path = toPath(fileName) @@ -97,7 +96,6 @@ class BaseScalaCLIActionSuite(name: String) expectError, filterAction, overrideLayout = layout, - retryAction = retryAction, ) } } diff --git a/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala b/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala index 3926de64f68..c6e306bd8a7 100644 --- a/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala +++ b/tests/slow/src/test/scala/tests/scalacli/ScalaCliActionsSuite.scala @@ -53,8 +53,6 @@ class ScalaCliActionsSuite scalaCliOptions = List("--actions", "-S", scalaVersion), expectNoDiagnostics = false, selectedActionIndex = 1, - // Scala CLI doesn't publish everything with the normal diagnostics, but later - retryAction = 5, ) checkScalaCLI( @@ -85,8 +83,6 @@ class ScalaCliActionsSuite scalaCliOptions = List("--actions", "-S", scalaVersion), expectNoDiagnostics = false, selectedActionIndex = 1, - // Scala CLI doesn't publish everything with the normal diagnostics, but later - retryAction = 5, ) checkNoActionScalaCLI( diff --git a/tests/unit/src/main/scala/tests/Library.scala b/tests/unit/src/main/scala/tests/Library.scala index 2f5daa8b16a..1a8faf215ce 100644 --- a/tests/unit/src/main/scala/tests/Library.scala +++ b/tests/unit/src/main/scala/tests/Library.scala @@ -87,7 +87,7 @@ object Library { val fetch = Fetch .create() .withMainArtifacts() - .withClassifiers(Set("sources", "_").asJava) + .addClassifiers("sources") .withDependencies( deps: _* ) diff --git a/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala b/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala index 2c14a37bc3c..6350030fa41 100644 --- a/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala +++ b/tests/unit/src/main/scala/tests/codeactions/BaseCodeActionLspSuite.scala @@ -59,7 +59,6 @@ abstract class BaseCodeActionLspSuite( expectError: Boolean = false, filterAction: CodeAction => Boolean = _ => true, overrideLayout: Option[String] = None, - retryAction: Int = 0, )(implicit loc: Location): Unit = { val scalacOptionsJson = if (scalacOptions.nonEmpty) @@ -89,7 +88,6 @@ abstract class BaseCodeActionLspSuite( changeFile, expectError, filterAction, - retryAction, ) } @@ -107,7 +105,6 @@ abstract class BaseCodeActionLspSuite( changeFile: String => String = identity, expectError: Boolean = false, filterAction: CodeAction => Boolean = _ => true, - retryAction: Int = 0, )(implicit loc: Location): Unit = { val files = FileLayout.mapFromString(layout) val (path, input) = files @@ -123,25 +120,6 @@ abstract class BaseCodeActionLspSuite( if (renamePath.nonEmpty) input.replace("<<", "").replace(">>", "") else expectedCode - def assertActionsWithRetry( - retry: Int = retryAction - ): Future[List[CodeAction]] = { - server - .assertCodeAction( - path, - changeFile(input), - expectedActions, - kind, - filterAction = filterAction, - ) - .recoverWith { - case _: Throwable if retry > 0 => - Thread.sleep(1000) - assertActionsWithRetry(retry - 1) - case _: Throwable if expectError => Future.successful(Nil) - } - } - test(name) { cleanWorkspace() for { @@ -157,7 +135,18 @@ abstract class BaseCodeActionLspSuite( path, changeFile(input).replace("<<", "").replace(">>", ""), ) - codeActions <- assertActionsWithRetry() + codeActions <- + server + .assertCodeAction( + path, + changeFile(input), + expectedActions, + kind, + filterAction = filterAction, + ) + .recover { + case _: Throwable if expectError => Nil + } _ <- client.applyCodeAction(selectedActionIndex, codeActions, server) _ <- server.didSave(newPath) { _ => if (newPath != path)