On 08/20/2017 09:28 PM, Alex Harsanyi wrote:
I just noticed that the GUI test runner displays "test did not clean up
resources" messages on my tests, but it is not clear to me what resources are not
being cleaned up.
I tried to reproduce the problem in the following test case:
#lang racket
(require rackunit rackunit/gui db)
(define ts
(test-suite
"test suite"
(test-case
"test-case"
(check-not-exn
(lambda ()
(define db (sqlite3-connect #:database 'memory #:mode 'create))
(disconnect db))))))
(test/gui ts)
Here, a sqlite database is created in memory than the connection is closed.
The test runner complains that the data base connection is not cleaned up. It
also complains about a thread not being cleaned up, but the test does not
create any threads (at least not explicitly). See attached picture for
details.
Can someone explain to me how to clean up properly in such a test?
The first entry is my fault: disconnecting a sqlite3 connection does not
unregister the connection from its custodian. I'll push a fix soon.
The second entry looks like the finalizer thread for prepared
statements. It looks like the db module loads that module lazily, only
when the first connection function (like `sqlite3-connect`) is called,
so its initial custodian is the test case custodian. I can fix that by
having db/base depend strictly on the prepared statement module.
Ryan
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.