packages feed

tasty 1.5.4 → 1.5.5

raw patch · 7 files changed

+53/−26 lines, 7 filesdep +terminal-sizePVP ok

version bump matches the API change (PVP)

Dependencies added: terminal-size

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,20 @@ Changes ======= +Version 1.5.5+--------------++_2025-10-30_++* Revert making `-j` to entail `+RTS -N` automatically, restoring+  the behaviour from `tasty-1.5.3` and earlier+  ([#485](https://github.com/UnkindPartition/tasty/pull/485)).+* Ensure that disabling `--ansi-tricks` disables+  terminal width detection via ANSI tricks and disables+  attempts to hide / show the cursor+  ([#477](https://github.com/UnkindPartition/tasty/pull/477),+   [#481](https://github.com/UnkindPartition/tasty/pull/481)).+ Version 1.5.4 -------------- 
Test/Tasty/Ingredients/ConsoleReporter.hs view
@@ -68,6 +68,10 @@ #endif import System.IO.Unsafe +#if defined(MIN_VERSION_terminal_size)+import qualified System.Console.Terminal.Size as TermSize+#endif+ -------------------------------------------------- -- TestOutput base definitions --------------------------------------------------@@ -130,11 +134,19 @@ -- to avoid unsafePerformIO. -- (We cannot add another argument to 'buildTestOutput' -- in the middle of tasty-1.5 series, because it is exported)-terminalWidth :: Maybe Int-terminalWidth = unsafePerformIO $ do-  isTerminalStdin <- hIsTerminalDevice stdin-  if isTerminalStdin-  then fmap (fmap snd) getTerminalSize+terminalWidth :: Bool -> Maybe Int+terminalWidth isTermWithTricks = unsafePerformIO $ do+  if isTermWithTricks+  then do+    isTerminalStdin <- hIsTerminalDevice stdin+    if isTerminalStdin+    then+#if defined(MIN_VERSION_terminal_size)+      fmap (fmap TermSize.width) TermSize.size+#else+      fmap (fmap snd) getTerminalSize+#endif+    else pure Nothing   else pure Nothing {-# NOINLINE terminalWidth #-} @@ -155,7 +167,8 @@   let     -- Do not retain the reference to the tree more than necessary     !rawAlignment = computeAlignment opts tree-    !alignment = case terminalWidth of+    !(AnsiTricks isTermWithTricks) = lookupOption opts+    !alignment = case terminalWidth isTermWithTricks of       Nothing -> rawAlignment       Just width -> min (width - approxMaxResultShortDescriptionWidth) rawAlignment @@ -587,7 +600,7 @@       isTerm <- hSupportsANSI stdout       isTermColor <- hSupportsANSIColor stdout -      (\k -> if isTerm+      (\k -> if isTerm && ansiTricks         -- When killing with Ctrl+C 'showCursor' can fail         -- to restore terminal cursor if not flushed explicitly         then (do hideCursor; k) `finally` (do showCursor; hFlush stdout)
Test/Tasty/Options/Core.hs view
@@ -20,8 +20,6 @@ #if !MIN_VERSION_base(4,11,0) import Data.Monoid #endif-import Control.Concurrent-import System.IO.Unsafe  import Test.Tasty.Options import Test.Tasty.Patterns@@ -39,13 +37,12 @@ newtype NumThreads = NumThreads { getNumThreads :: Int }   deriving (Eq, Ord, Num) instance IsOption NumThreads where-  defaultValue = unsafePerformIO $ NumThreads <$>-      if rtsSupportsBoundThreads then getNumProcessors else pure 1+  defaultValue = NumThreads numCapabilities   parseValue = mfilter onlyPositive . fmap NumThreads . safeRead   optionName = return "num-threads"   optionHelp = return "Number of threads to use for tests execution"   optionCLParser = mkOptionCLParser (short 'j' <> metavar "NUMBER")-  showDefaultValue _ = Just "Number of cores when using threaded RTS, 1 for non-threaded"+  showDefaultValue _ = Just "# of cores/capabilities"  -- | Filtering function to prevent non-positive number of threads onlyPositive :: NumThreads -> Bool
Test/Tasty/Parallel.hs view
@@ -41,12 +41,6 @@ -- actions themselves. Any exceptions that reach this function or its -- threads are by definition unexpected. runInParallel nthreads actions = do-  -- When linked with threaded RTS, ensure we have enough Capabilities-  -- so that all Haskell worker threads can truly run in parallel.-  when rtsSupportsBoundThreads $ do-    ncap <- getNumCapabilities-    when (ncap < nthreads) $ setNumCapabilities nthreads-   callingThread <- myThreadId    -- Don't let the main thread be garbage-collected
Test/Tasty/Run.hs view
@@ -22,9 +22,9 @@ import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Reader (ReaderT(..), local, ask) import Control.Monad.Trans.Writer (execWriterT, tell)-import Control.Concurrent-import Control.Concurrent.STM-import Control.Concurrent.Async+import Control.Concurrent (threadDelay)+import Control.Concurrent.STM (TVar, STM, check, readTVar, writeTVar, atomically, retry, throwSTM, newTVarIO)+import Control.Concurrent.Async (wait, asyncThreadId, withAsync) import Control.Exception as E import Control.Arrow import Data.Monoid (First(..))@@ -436,7 +436,7 @@       TGroup _ trees    -> mconcat (map collectFinalizers trees)       TAction _         -> mempty -    goSeqGroup +    goSeqGroup       :: DependencyType       -> Seq Dependency       -> Tr
Test/Tasty/Runners/Utils.hs view
@@ -4,8 +4,6 @@ module Test.Tasty.Runners.Utils where  import Control.Exception-import Control.Concurrent (mkWeakThreadId, myThreadId)-import Control.Monad (forM_) import Text.Printf import Foreign.C (CInt) @@ -27,6 +25,8 @@ #endif  #if INSTALL_HANDLERS+import Control.Concurrent (mkWeakThreadId, myThreadId)+import Control.Monad (forM_) import System.Posix.Signals import System.Mem.Weak (deRefWeak) #endif
tasty.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                tasty-version:             1.5.4+version:             1.5.5 synopsis:            Modern and extensible testing framework description:         Tasty is a modern testing framework for Haskell.                      It lets you combine your unit tests, golden@@ -27,6 +27,11 @@     Depend on the unix package to install signal handlers   default: True +flag terminal-size+  description:+    Depend on the terminal-size package to get terminal size+  default: True+ library   exposed-modules:     Test.Tasty@@ -63,9 +68,13 @@     stm                  >= 2.3  && < 2.6,     containers           >= 0.5.8 && < 0.9,     transformers         >= 0.5  && < 0.7,-    tagged               >= 0.5  && < 0.9,+    tagged               >= 0.5  && < 0.10,     optparse-applicative >= 0.14 && < 0.20,     ansi-terminal        >= 0.9  && < 1.2++  if flag(terminal-size) && !arch(wasm32)+    build-depends:+      terminal-size >= 0.3 && < 0.4    -- No reason to depend on unbounded-delays on 64-bit architecture   if(!arch(x86_64) && !arch(aarch64) && !arch(ppc64le) && !arch(ppc64) && !arch(s390x) && !arch(riscv64) && !arch(loongarch64))