@@ -556,70 +556,77 @@ abstract class TestTestDefinitions extends ScalaCliSuite with TestScalaVersionAr
556556
557557 for ((platformName, platformArgs) <- platforms)
558558 test(s " custom test framework $platformName" ) {
559- val inputs = TestInputs (
560- os.rel / " MyTests.test.scala" ->
561- s """ //> using dep com.lihaoyi::utest:: $utestVersion
562- |
563- |package mytests
564- |import utest._
565- |
566- |object MyTests extends TestSuite {
567- | val tests = Tests {
568- | test("foo") {
569- | assert(2 + 2 == 4)
570- | println("Hello from " + "tests")
571- | }
572- | }
573- |}
574- | """ .stripMargin,
575- os.rel / " CustomFramework.test.scala" ->
576- """ package custom
577- |
578- |class CustomFramework extends utest.runner.Framework {
579- | override def setup(): Unit =
580- | println("Hello from CustomFramework")
581- |}
582- |""" .stripMargin
583- )
584- inputs.fromRoot { root =>
585- val baseRes = os.proc(TestUtil .cli, " test" , extraOptions, platformArgs, " ." )
586- .call(cwd = root)
587- val baseOutput = baseRes.out.text()
588- expect(baseOutput.contains(" Hello from tests" ))
589- expect(! baseOutput.contains(" Hello from CustomFramework" ))
590-
591- val cmd = Seq [os.Shellable ](
592- TestUtil .cli,
593- " test" ,
594- extraOptions,
595- platformArgs,
596- " ." ,
597- " --test-framework" ,
598- " custom.CustomFramework"
559+ TestUtil .retryOnCi(maxAttempts = if (platformName.contains(" native" )) 3 else 1 ) {
560+ val inputs = TestInputs (
561+ os.rel / " MyTests.test.scala" ->
562+ s """ //> using dep com.lihaoyi::utest:: $utestVersion
563+ |
564+ |package mytests
565+ |import utest._
566+ |
567+ |object MyTests extends TestSuite {
568+ | val tests = Tests {
569+ | test("foo") {
570+ | assert(2 + 2 == 4)
571+ | println("Hello from " + "tests")
572+ | }
573+ | }
574+ |}
575+ | """ .stripMargin,
576+ os.rel / " CustomFramework.test.scala" ->
577+ """ package custom
578+ |
579+ |class CustomFramework extends utest.runner.Framework {
580+ | override def setup(): Unit =
581+ | println("Hello from CustomFramework")
582+ |}
583+ |""" .stripMargin
599584 )
600- val res = os.proc(cmd).call(cwd = root)
601- val output = res.out.text()
602- expect(output.contains(" Hello from tests" ))
603- expect(output.contains(" Hello from CustomFramework" ))
585+ inputs.fromRoot { root =>
586+ val baseRes = os.proc(TestUtil .cli, " test" , extraOptions, platformArgs, " ." )
587+ .call(cwd = root)
588+ val baseOutput = baseRes.out.text()
589+ expect(baseOutput.contains(" Hello from tests" ))
590+ expect(! baseOutput.contains(" Hello from CustomFramework" ))
591+
592+ val cmd = Seq [os.Shellable ](
593+ TestUtil .cli,
594+ " test" ,
595+ extraOptions,
596+ platformArgs,
597+ " ." ,
598+ " --test-framework" ,
599+ " custom.CustomFramework"
600+ )
601+ val res = os.proc(cmd).call(cwd = root)
602+ val output = res.out.text()
603+ expect(output.contains(" Hello from tests" ))
604+ expect(output.contains(" Hello from CustomFramework" ))
605+ }
604606 }
605607 }
606608
607609 for ((platformName, platformArgs) <- platforms)
608610 test(s " Fail if no tests were run $platformName" ) {
609- val inputs = TestInputs (
610- os.rel / " MyTests.test.scala" ->
611- s """ //> using dep org.scalameta::munit:: $munitVersion
612- |
613- |object MyTests
614- | """ .stripMargin
615- )
611+ TestUtil .retryOnCi(maxAttempts = if (platformName.contains(" native" )) 3 else 1 ) {
612+ val inputs = TestInputs (
613+ os.rel / " MyTests.test.scala" ->
614+ s """ //> using dep org.scalameta::munit:: $munitVersion
615+ |
616+ |object MyTests
617+ | """ .stripMargin
618+ )
616619
617- inputs.fromRoot { root =>
618- val res = os.proc(TestUtil .cli, " test" , extraOptions, " --require-tests" , platformArgs, " ." )
619- .call(cwd = root, stderr = os.Pipe , mergeErrIntoOut = true , check = false )
620- expect(res.exitCode != 0 )
621- val output = res.out.text()
622- expect(output.contains(" Error: no tests were run" ) || output.contains(" No tests were run" ))
620+ inputs.fromRoot { root =>
621+ val res =
622+ os.proc(TestUtil .cli, " test" , extraOptions, " --require-tests" , platformArgs, " ." )
623+ .call(cwd = root, stderr = os.Pipe , mergeErrIntoOut = true , check = false )
624+ expect(res.exitCode != 0 )
625+ val output = res.out.text()
626+ expect(
627+ output.contains(" Error: no tests were run" ) || output.contains(" No tests were run" )
628+ )
629+ }
623630 }
624631 }
625632
0 commit comments