cleaner test dependencies
authorJoey Hess <joeyh@joeyh.name>
Wed, 16 Mar 2022 16:53:08 +0000 (12:53 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 16 Mar 2022 16:53:08 +0000 (12:53 -0400)
This improves the display of tests.

tasty-1.2 is in debian stable.

Sponsored-by: Dartmouth College's Datalad project
Test.hs
Test/Framework.hs
git-annex.cabal

diff --git a/Test.hs b/Test.hs
index 58d6b4fd84cbe297e4e6fa20b0289a8a852e3c29..d5fddeabf52816f6cdbf1b5d14c44874bab3d20f 100644 (file)
--- 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
index 7f16f1833cf7d3fa056ae59c63962455635491da..a85e9cb95c272eacc6a6ea8c132049366ac0cb9c 100644 (file)
@@ -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 ()
index f18af00ba1024ffc9b6ea0f8261f16293848012c..0a015d44152aedc360ba5edaecb92a34ea9906b6 100644 (file)
@@ -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,