diff --git a/unittest2.html b/unittest2.html index 7e5378e..5406c59 100644 --- a/unittest2.html +++ b/unittest2.html @@ -1426,15 +1426,7 @@ nim c -r test 'bug #*::' '::#*'
 nim c -r --threads:on -d:nimtestParallel testfile.nim
 # or
-NIMTEST_PARALLEL=1 nim c -r --threads:on testfile.nim

Since output formatters are kept in a threadvar, they need to be initialised for each thread in the thread pool. This means that customisation can only be done in a suite's "setup" section, which will run before each test in that suite - hence the need to clear existing formatters before adding new ones:

-
suite "custom formatter":
-  setup:
-    clearOutputFormatters()
-    addOutputFormatter(newConsoleOutputFormatter(PRINT_FAILURES, colorOutput=false))
-  
-  # if you need to revert back to the default after the suite
-  teardown:
-    clearOutputFormatters()

There are some implicit barriers where we wait for all the spawned jobs to complete: before and after each test suite and at the main thread's exit.

+NIMTEST_PARALLEL=1 nim c -r --threads:on testfile.nim

There are some implicit barriers where we wait for all the spawned jobs to complete: before and after each test suite and at the main thread's exit.

The suite-related barriers are there to avoid mixing test output, but they also affect which groups of tests can be run in parallel, so keep them in mind when deciding how many tests to place in different suites (or between suites).

Example

suite "description for this stuff":
@@ -1461,7 +1453,8 @@ NIMTEST_PARALLEL=1 nim c -r --threads:on testfile.nim

Since output forma expect(IndexError): discard v[4] - echo "suite teardown: run once after the tests"

+ suiteTeardown: + echo "suite teardown: run once after the tests"

Types

@@ -1826,7 +1819,7 @@ Same as check except any failed test causes the program to quit imm