diff --git a/ghcide/test/exe/FindDefinitionAndHoverTests.hs b/ghcide/test/exe/FindDefinitionAndHoverTests.hs index 63d8dd7ab7..e60d6e8cfc 100644 --- a/ghcide/test/exe/FindDefinitionAndHoverTests.hs +++ b/ghcide/test/exe/FindDefinitionAndHoverTests.hs @@ -159,7 +159,7 @@ tests = let holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText ["_ :: a -> Maybe a"]] cccL17 = Position 17 16 ; docLink = [ExpectHoverTextRegex "\\*Defined in 'GHC.Types'\\* \\*\\(ghc-prim-[0-9.]+\\)\\*\n\n"] imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3] - reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], if ghcVersion >= GHC94 && ghcVersion < GHC910 then mkL bar 3 5 3 8 else mkL bar 3 0 3 14] + reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], mkL bar 3 0 3 14] -- thLocL57 = Position 59 10 ; thLoc = [ExpectHoverText ["Identity"]] cmtL68 = Position 67 0 ; lackOfdEq = [ExpectHoverExcludeText ["$dEq"]] import310 = Position 3 10; pkgTxt = [ExpectHoverText ["Data.Text\n\ntext-"]] @@ -211,6 +211,7 @@ tests = let -- Flaky on Windows: https://github.com/haskell/haskell-language-server/issues/2997 testM no yes reexported reexportedSig "Imported symbol (reexported)" else + -- Flaky after $TEMPDIR cleanup: https://github.com/haskell/haskell-language-server/issues/4348 testM yes yes reexported reexportedSig "Imported symbol (reexported)" , test no yes thLocL57 thLoc "TH Splice Hover" , test yes yes import310 pkgTxt "show package name and its version" diff --git a/hls-test-utils/src/Test/Hls.hs b/hls-test-utils/src/Test/Hls.hs index 2ca477d896..b812173991 100644 --- a/hls-test-utils/src/Test/Hls.hs +++ b/hls-test-utils/src/Test/Hls.hs @@ -133,6 +133,7 @@ import System.Directory (canonicalizePath, import System.Environment (lookupEnv, setEnv) import System.FilePath import System.IO.Extra (newTempDirWithin) +import System.IO.Temp (createTempDirectory) import System.IO.Unsafe (unsafePerformIO) import System.Process.Extra (createPipe) import System.Time.Extra @@ -560,9 +561,9 @@ setupTestEnvironment :: IO FilePath setupTestEnvironment = do tmpDirRoot <- getTemporaryDirectory let testRoot = tmpDirRoot "hls-test-root" - testCacheDir = testRoot ".cache" - createDirectoryIfMissing True testCacheDir - setEnv "XDG_CACHE_HOME" testCacheDir + createDirectoryIfMissing True testRoot + tempCacheDir <- createTempDirectory testRoot ".cache" + setEnv "XDG_CACHE_HOME" tempCacheDir pure testRoot goldenWithHaskellDocFormatter