Re: [racket-users] "Test did not clean up resources" message from GUI test runner

2017-08-21 Thread Alex Harsanyi
On Tuesday, August 22, 2017 at 12:53:20 AM UTC+8, Ryan Culpepper wrote:
> 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.
> 

Thanks for fixing this.

> 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.
> 

I only got this message in the simple test case I have provided.  In my actual 
tests, I do more than just open and close a database connection and I don't get 
this warning.

As a side note, it seems that only the GUI test runner is reporting these 
warnings.  I normally run the tests using "run-tests" from the 
"rackunit/text-ui" module and the warnings are not reported.

> 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.


Re: [racket-users] "Test did not clean up resources" message from GUI test runner

2017-08-21 Thread Ryan Culpepper

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.


[racket-users] "Test did not clean up resources" message from GUI test runner

2017-08-20 Thread Alex Harsanyi
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?

Thanks,
Alex.

-- 
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.