HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulesydtest-0.33.0.0Haskell2010

Test.Syd.Modify

This module defines functions for declaring different test settings

  • 5 types
  • 27 values
  • Packagesydtest-0.33.0.0
  • Exports32
  • LanguageHaskell2010
  • LicenceLicenseRef-OtherLicense
  • SourceModify.hs

Declaring different test settings

6 declarations
datadata TestRunSettings
#
Instances4Eq, Show, Generic, Rep

Declaring parallelism

5 declarations
valueparallel :: TestDefM a b c -> TestDefM a b c
#

Declare that all tests below may be run in parallel. (This is the default.)

valueparallelWith :: Word -> TestDefM a b c -> TestDefM a b c
#

Declare that at most this many of the tests below may run at once.

The bound is across everything below this point together, not per group, and it does not add threads: it only ever holds tests back. Reach for it when tests contend for something the suite does not own, such as one database server shared by a database per test, where running all of them at once is slower than running some of them and sequential gives up more than it needs to.

datadata Parallelism
#

Constructors

  • Parallel

    As many at once as there are threads to run them.

  • ParallelWith !Word

    At most this many at once, however many threads there are.

    For tests that contend for something the test suite does not own, like one database server behind a database per test. Running fewer of those at once can be faster than running all of them, and is the smaller instrument where Sequential would do.

  • Sequential

    One at a time.

Instances4Eq, Show, Generic, Rep

Declaring randomisation order

4 declarations
Instances4Eq, Show, Generic, Rep

Modifying timeouts

3 declarations

Modifying the number of retries

3 declarations

Declaring flakiness

7 declarations
valueflaky :: Word -> TestDefM a b c -> TestDefM a b c
#

Mark a test suite as "potentially flaky" with a given number of retries.

This will retry any test in the given test group up to the given number of tries, and pass a test if it passes once. The test output will show which tests were flaky.

WARNING: This is only a valid approach to dealing with test flakiness if it is true that tests never pass accidentally. In other words: tests using flaky must be guaranteed to fail every time if an error is introduced in the code, it should only be added to deal with accidental failures, never accidental passes.

valueflakyWith :: Word -> String -> TestDefM a b c -> TestDefM a b c
#

Like flaky, but also shows the given message to the user whenever the test is flaky.

You could use it like this:

Example1 expression
flakyWith 3 "Something sometimes goes wrong with the database, see issue 6346" ourTestSuite
valuenotFlaky :: TestDefM a b c -> TestDefM a b c
#

Mark a test suite as "must not be flaky".

This is useful to have a subgroup of a group marked as flaky that must not be flaky afteral.

valuepotentiallyFlaky :: TestDefM a b c -> TestDefM a b c
#

Mark a test suite as 'potentially flaky', such that it will not fail if it is flaky but passes at least once.

datadata FlakinessMode
#
Instances4Eq, Show, Generic, Rep

Declaring expectations

4 declarations
datadata ExpectationMode
#
Instances4Eq, Show, Generic, Rep