Re: Closing connection

Daniel Dehennin <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
Oleg Broytman <[email protected]> writes:

> On Wed, Feb 01, 2012 at 02:53:20PM +0100, Daniel Dehennin wrote:
>> I found a thread[4] on the list speaking about the same issue
>> [4]  http://thread.gmane.org/gmane.comp.python.sqlobject/5769
>
>    The thread has the answer, IMO.

So, I should have not understand:

#+begin_src
test_init_job (TestJob.TestJob) ... E: setUp Cannot operate on a closed database.
#+end_src

I move the os.unlink fro the setUp() to tearDown() which call a new function:

#+begin_src python
def rebuildd_global_test_teardown():
        try:
            Rebuildd().sqlconnection.close()
	    sqlobject.sqlhub.processConnection = Rebuildd().sqlconnection
	    sqlobject.dbconnection.TheURIOpener.cachedURIs={}
            os.unlink("/tmp/rebuildd-tests.db")
        except Exception, e:
            print "E: tearDown %s" % e
            pass
#+end_src

Regards.
-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.