Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tcltest should not exit an application

Closed / Fixed8413e79232449d82d512edfee22ded5701f683b5Created 7 years agoUpdated 36 days ago
Descriptionplain2020-01-29 16:47:09
Well, the comment says it all.
From tcltest-2.5.1.tm:

# exit only if running Tk in non-interactive mode
#This should be changed to determine if an event
# loop is running, which is the real issue.
# Actually, this doesn't belong here at all.  A package
# really has no business [exit]-ing an application.
if {![catch {package present Tk}] && ![testConstraint interactive]} {
    exit
}

Took me an hour because I thought TCL is crashing. Here I see it's exiting.
Please fix/remove the exit from this code.

Regards
Referenced by6
serhiy.storchakawiki2026-10-20 19:51:17

Still the case on main, 9.0 and 8.6. The exit is there so that wish foo.test does not stay in the event loop after the tests, so simply removing it would change how Tk test files run.

Proposed fix in branch [tcltest-no-exit-when-sourced]: cleanupTests exits only when, in addition, the test file is the main script of the application ([file normalize [info script]] eq [file normalize $::argv0]). An application that sources a test file keeps running. wish foo.test and Tk's all.tcl exit as before. The behaviour is now documented in tcltest.n; new test tcltest-29.1.

jan.nijtmanswiki2026-10-22 08:31:11

Fixed in [trunk], not backported yet to 9.0 and 8.6

jan.nijtmanswiki2026-10-28 13:44:23

Now also backported to core-9-0-branch and core-8-6-branch

Closing. Many thanks!

Log in (anonymous is fine) to add a comment.