Isolate test suite from global git config settings.
This commit is contained in:
parent
b56218f0c2
commit
c3fdaf764d
3 changed files with 15 additions and 0 deletions
10
Test.hs
10
Test.hs
|
@ -112,6 +112,7 @@ optParser = TestOptions
|
|||
runner :: Maybe (TestOptions -> IO ())
|
||||
runner = Just $ \opts -> do
|
||||
ensuretmpdir
|
||||
isolateGitConfig
|
||||
crippledfilesystem <- Annex.Init.probeCrippledFileSystem' tmpdir
|
||||
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of
|
||||
Nothing -> error "No tests found!?"
|
||||
|
@ -1787,6 +1788,15 @@ ensuretmpdir = do
|
|||
e <- doesDirectoryExist tmpdir
|
||||
unless e $
|
||||
createDirectory tmpdir
|
||||
|
||||
{- Prevent global git configs from affecting the test suite. -}
|
||||
isolateGitConfig :: IO ()
|
||||
isolateGitConfig = do
|
||||
let tmphome = tmpdir </> "home"
|
||||
createDirectoryIfMissing False tmphome
|
||||
Utility.Env.setEnv "HOME" tmphome True
|
||||
Utility.Env.setEnv "XDG_CONFIG_HOME" tmphome True
|
||||
Utility.Env.setEnv "GIT_CONFIG_NOSYSTEM" "1" True
|
||||
|
||||
cleanup :: FilePath -> IO ()
|
||||
cleanup = cleanup' False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue