From 9a41cf1b03d2fd7d9debb1ec6190f411de6863ca Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Thu, 13 Aug 2026 16:08:33 -0700 Subject: [PATCH] Document the `skip` keyword argument of `@testitem` `skip` accepts either a `Bool` literal or an arbitrary expression. The expression is evaluated in the *test process*, immediately before the test item would have run, so checks like `VERSION < v"1.11"` or `Sys.iswindows()` see the environment the tests actually run in rather than the one that discovered them. Defaults to `false`. The macro remains a no-op marker; parsing lands in TestItemDetection.jl and the value is carried through JuliaWorkspaces.jl. Part of stream S1 (Discovery) of the ReTestItems feature-delta plan (A.10 item 5). Co-Authored-By: Claude Opus 5 (1M context) --- src/TestItems.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/TestItems.jl b/src/TestItems.jl index caedf3c..13e0604 100644 --- a/src/TestItems.jl +++ b/src/TestItems.jl @@ -21,6 +21,12 @@ to share setup code between test items. before running the test code. Defaults to `true`. - `setup::Vector{Symbol}`: Names of `@testmodule` or `@testsnippet` definitions to evaluate before the test item runs. +- `skip`: Either a `Bool` literal, or an arbitrary expression that evaluates to a `Bool`. + When it is `true` the test item is not run and is reported as skipped. Defaults to + `false`. An expression is evaluated **in the test process**, immediately before the + test item would have run, so checks like `VERSION < v"1.11"` or `Sys.iswindows()` see + the environment of the process the tests actually run in, not the one that discovered + them. ## Examples @@ -38,6 +44,14 @@ end db = DatabaseHelper.connect() @test isopen(db) end + +@testitem "not ready yet" skip=true begin + @test false +end + +@testitem "needs a recent Julia" skip=(VERSION < v"1.11") begin + @test true +end ``` """ macro testitem(ex...)