Skip to content

and_exit cannot be overriden when using test subcommand #438

Description

@edwintorok

When using Alcotest.run ~and_exit:false the test will still call exit 0 when the test subcommand is used (all works fine when it runs automatically with the default command).
This is a problem because cleanup handlers registered with Fun.protect won't run.

To reproduce:

alcobug.zip

dune runtest
File "test/dune", line 2, characters 7-19:
2 |  (name test_alcobug)
           ^^^^^^^^^^^^
Testing `bug'.
This run has ID `NE0Z2SZ9'.

  [OK]          bug          0   Bug.

Test Successful in 0.000s. 1 test run.

[36185]: Code before Fun.protect

[36185]: at_exit

[36185]: exit called, but finally didn't run yet!

This is probably due to this line:

alcotest.1.9.1/src/alcotest-engine/cli.ml
133:        Config.User.term ~stdout ~stderr ~and_exit:true ~record_backtrace:true

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