Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aantron opened this issue Feb 21, 2021 · 2 comments
Open

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

aantron opened this issue Feb 21, 2021 · 2 comments

Comments

@aantron
Copy link
Contributor

aantron commented Feb 21, 2021

For example, OUnit has https://gildor478.github.io/ounit/ounit2/index.html#skip-and-todo-tests. Lwt's ad-hoc tester has ~only_if arguments for both individual tests and entire test suites.

@craigfe
Copy link
Member

craigfe commented Feb 22, 2021

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.

@MisterDA
Copy link
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 *)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants