From: Joey Hess Date: Wed, 16 Mar 2022 16:53:08 +0000 (-0400) Subject: cleaner test dependencies X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~75^2~127 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=be31a8a3d20625b349ef43de8a58363e1bfd186b;p=git-annex.git cleaner test dependencies This improves the display of tests. tasty-1.2 is in debian stable. Sponsored-by: Dartmouth College's Datalad project --- diff --git a/Test.hs b/Test.hs index 58d6b4fd84..d5fddeabf5 100644 --- a/Test.hs +++ b/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 diff --git a/Test/Framework.hs b/Test/Framework.hs index 7f16f1833c..a85e9cb95c 100644 --- a/Test/Framework.hs +++ b/Test/Framework.hs @@ -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 () diff --git a/git-annex.cabal b/git-annex.cabal index f18af00ba1..0a015d4415 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -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,