Skip to content

Is there a way to skip tests based on an ad-hoc run-time condition? #293

Closed

Description

@aantron

Activity

  1. craigfe commented on Feb 22, 2021

    @craigfe
    Member

    Sadly, there is not. The closest that Alcotest gets to this is the `Quick/`Slow tags on tests.

    The need for a more generalised form of that feature is tracked by #124. I have a WIP draft of an "Alcotest 2.0" API that aims to let users attach arbitrary metadata to tests and then pass filters over that metadata at run-time, which I hope will meet this need.

  2. MisterDA commented on Mar 27, 2023

    @MisterDA
    Collaborator

    This has been (partially?) fixed with #368, released in Alcotest 1.7.0, with Alcotest.skip.

    let test_only_on_windows () =
      if Sys.os_type <> "Win32" then Alcotest.skip () else ();
      (* actual test code *)
  3. samoht commented on Nov 2, 2026

    @samoht
    Member

    As per @MisterDA's answer, there is now a way to do this. So I'm closing the issue. Feel free to re-open if that doesn't work for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions