cleaner test dependencies
This improves the display of tests. tasty-1.2 is in debian stable. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
d3b7c6705c
commit
be31a8a3d2
3 changed files with 14 additions and 18 deletions
19
Test.hs
19
Test.hs
|
@ -107,8 +107,8 @@ runner opts = parallelTestRunner opts tests
|
|||
tests :: Int -> Bool -> Bool -> TestOptions -> [TestTree]
|
||||
tests n crippledfilesystem adjustedbranchok opts =
|
||||
properties
|
||||
: withTestMode remotetestmode Nothing testRemotes
|
||||
: concatMap mkunittests testmodes
|
||||
: withTestMode remotetestmode testRemotes
|
||||
: concatMap mkrepotests testmodes
|
||||
where
|
||||
testmodes = catMaybes
|
||||
[ canadjust ("v8 adjusted unlocked branch", (testMode opts (RepoVersion 8)) { adjustedUnlockedBranch = True })
|
||||
|
@ -122,9 +122,9 @@ tests n crippledfilesystem adjustedbranchok opts =
|
|||
canadjust v
|
||||
| adjustedbranchok = Just v
|
||||
| otherwise = Nothing
|
||||
mkunittests (d, te) = map
|
||||
(\uts -> withTestMode te (Just initTests) uts)
|
||||
(unitTests d n)
|
||||
mkrepotests (d, te) = map
|
||||
(\uts -> withTestMode te uts)
|
||||
(repoTests d n)
|
||||
|
||||
properties :: TestTree
|
||||
properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" $
|
||||
|
@ -244,15 +244,15 @@ testRemote testvariants remotetype setupremote =
|
|||
desckeysize sz = descas ("key size " ++ show sz)
|
||||
|
||||
{- These tests set up the test environment, but also test some basic parts
|
||||
- of git-annex. They are always run before the unitTests. -}
|
||||
- of git-annex. They are always run before the repoTests. -}
|
||||
initTests :: TestTree
|
||||
initTests = testGroup "Init Tests"
|
||||
[ testCase "init" test_init
|
||||
, testCase "add" test_add
|
||||
]
|
||||
|
||||
unitTests :: String -> Int -> [TestTree]
|
||||
unitTests note numparts = map (testGroup ("Unit Tests " ++ note)) $ sep
|
||||
repoTests :: String -> Int -> [TestTree]
|
||||
repoTests note numparts = map mk $ sep
|
||||
[ testCase "add dup" test_add_dup
|
||||
, testCase "add extras" test_add_extras
|
||||
, testCase "readonly remote" test_readonly_remote
|
||||
|
@ -332,6 +332,9 @@ unitTests note numparts = map (testGroup ("Unit Tests " ++ note)) $ sep
|
|||
, testCase "addurl" test_addurl
|
||||
]
|
||||
where
|
||||
mk l = testGroup groupname (initTests : map adddep l)
|
||||
adddep = Test.Tasty.after AllSucceed (groupname ++ ".Init Tests")
|
||||
groupname = "Repo Tests " ++ note
|
||||
sep = sep' (replicate numparts [])
|
||||
sep' (p:ps) (l:ls) = sep' (ps++[l:p]) ls
|
||||
sep' ps [] = ps
|
||||
|
|
|
@ -457,19 +457,12 @@ testMode opts v = TestMode
|
|||
hasUnlockedFiles :: TestMode -> Bool
|
||||
hasUnlockedFiles m = unlockedFiles m || adjustedUnlockedBranch m
|
||||
|
||||
withTestMode :: TestMode -> Maybe TestTree -> TestTree -> TestTree
|
||||
withTestMode testmode minittests = withResource prepare release . const
|
||||
withTestMode :: TestMode -> TestTree -> TestTree
|
||||
withTestMode testmode = withResource prepare release . const
|
||||
where
|
||||
prepare = do
|
||||
setTestMode testmode
|
||||
setmainrepodir =<< newmainrepodir
|
||||
case minittests of
|
||||
Just inittests ->
|
||||
case tryIngredients [consoleTestReporter] mempty inittests of
|
||||
Nothing -> error "No tests found!?"
|
||||
Just act -> unlessM act $
|
||||
error "init tests failed! cannot continue"
|
||||
Nothing -> return ()
|
||||
release _ = noop
|
||||
|
||||
setTestMode :: TestMode -> IO ()
|
||||
|
|
|
@ -374,7 +374,7 @@ Executable git-annex
|
|||
attoparsec (>= 0.13.2.2),
|
||||
concurrent-output (>= 1.10),
|
||||
QuickCheck (>= 2.10.0),
|
||||
tasty (>= 0.7),
|
||||
tasty (>= 1.2),
|
||||
tasty-hunit,
|
||||
tasty-quickcheck,
|
||||
tasty-rerun,
|
||||
|
|
Loading…
Reference in a new issue