Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test by a test env setup refactor #4273

Closed
wants to merge 9 commits into from
7 changes: 4 additions & 3 deletions hls-test-utils/src/Test/Hls.hs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,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
Expand Down Expand Up @@ -556,9 +557,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
Expand Down
Loading