UnkindPartition / tasty

Modern and extensible testing framework for Haskell
637 stars 108 forks source link

1.5.1 breaks Cabal test suites #421

Closed geekosaur closed 1 month ago

geekosaur commented 1 month ago

We've been using tasty 1.5, but 1.5.1 was just released today and now our CI gets:

tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs:34:25: error: [GHC-83865]
Error:     • Couldn't match expected type: (Test.QuickCheck.Random.QCGen, Int)
                  with actual type: Maybe a1
    • In the pattern: Just override
      In the pattern: QuickCheckReplay (Just override)
      In a case alternative:
          QuickCheckReplay (Just override) -> return override
   |
34 |       QuickCheckReplay (Just override) -> return override
   |                         ^^^^^^^^^^^^^

tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs:35:24: error: [GHC-83865]
Error:     • Couldn't match expected type: (Test.QuickCheck.Random.QCGen, Int)
                  with actual type: Maybe a0
    • In the pattern: Nothing
      In the pattern: QuickCheckReplay Nothing
      In a case alternative:
          QuickCheckReplay Nothing -> getStdRandom random
   |
35 |       QuickCheckReplay Nothing -> getStdRandom random
   |                        ^^^^^^^

tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs:37:39: error: [GHC-83865]
Error:     • Couldn't match expected type: (Test.QuickCheck.Random.QCGen, Int)
                  with actual type: Maybe a1
    • In the first argument of ‘QuickCheckReplay’, namely
        ‘(Just replay)’
      In the first argument of ‘setOption’, namely
        ‘(QuickCheckReplay (Just replay))’
      In the first argument of ‘run’, namely
        ‘(setOption (QuickCheckReplay (Just replay)) options)’
    • Relevant bindings include
        replay :: a1
          (bound at tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs:33:5)
   |
37 |     run (setOption (QuickCheckReplay (Just replay)) options) test progress
   |                                       ^^^^^^^^^^^

While the errors involve QuickCheck, it hasn't changed recently, while the build log says Test.Tasty.Providers did change and forced the rebuild.

geekosaur commented 1 month ago

Confirmed: changing our tasty constraint from <1.6 to <1.5.1 our tests build. Shouldn't this kind of change not happen in minor releases?

Bodigrim commented 1 month ago

Isn't this caused by tasty-quickcheck-0.11, which is a major release?

Bodigrim commented 1 month ago

You can probably replace Nothing with QuickCheckReplayNone and Just with QuickCheckReplayLegacy. Or put tasty-quickcheck < 0.11 if time is short.

Bodigrim commented 1 month ago

https://github.com/UnkindPartition/tasty/blob/298f69b99b7f1561c93e0eff87dde57be5bbb079/quickcheck/Test/Tasty/QuickCheck.hs#L189-L195

...and then show (intSeed, replaySeed) instead of show replay.


It would be better to fix the root cause for Cabal's workaround by implementing https://github.com/UnkindPartition/tasty/issues/359#issuecomment-2048523531. Should be pretty straightforward.

geekosaur commented 1 month ago

We're trying to get a release out, so I'm pushing the constraint. I just got a successful validate run.

Bodigrim commented 1 month ago

Cf. https://github.com/haskell/cabal/pull/10136