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
When using
Alcotest.run ~and_exit:falsethe test will still callexit 0when thetestsubcommand is used (all works fine when it runs automatically with the default command).This is a problem because cleanup handlers registered with
Fun.protectwon't run.To reproduce:
alcobug.zip
This is probably due to this line: