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

Conditionally skip blocks #393

Open
talex5 opened this issue Aug 29, 2022 · 2 comments
Open

Conditionally skip blocks #393

talex5 opened this issue Aug 29, 2022 · 2 comments

Comments

@talex5
Copy link
Contributor

talex5 commented Aug 29, 2022

I'd like to skip certain blocks/sections, where the test is performed at runtime. For example, when running on macos in the opam sandbox we can't run any tests that use the network, and when running in a Docker container we might not be able to use IPv6.

Is there a good way to do this already?

If not, what's the best way to implement this? Perhaps if a block raises Mdx_skip then it could just be ignored?

@Leonidas-from-XIV
Copy link
Collaborator

You mean, only correct the block unless it raises Mdx_skip? I wonder if this isn't adding functionality to MDX that would better be solved on another level, e.g. do not run the MDX test via dune in some conditions.

@talex5
Copy link
Contributor Author

talex5 commented Aug 30, 2022

Yes. For example, oUnit has a skip_if function that raises a special exception (https://github.com/gildor478/ounit/blob/master/src/lib/ounit2/advanced/oUnitAssert.ml#L37), and crowbar has a similar guard function (https://github.com/stedolan/crowbar/blob/0cbe3ea7e990a7d233360e6a74b1cb5e712501ad/src/crowbar.ml#L93).

I don't think it can be solved easily with dune. For example, most of the Eio README file should still be tested by opam-repo-ci, just not the parts using the network when run on macos within the opam sandbox.

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

2 participants