Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
use SingletonThreadPool when running tests, NullPool when running for…
Browse files Browse the repository at this point in the history
… real
  • Loading branch information
mfrasca committed Dec 24, 2015
1 parent 79c7cdb commit 483d2e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bauble/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,12 @@ def open(uri, verify=True, show_error_dialogs=False):
global engine
new_engine = None

import sqlalchemy.pool as pool
from sqlalchemy.pool import NullPool, SingletonThreadPool
from bauble import gui
poolclass = gui and NullPool or SingletonThreadPool
new_engine = sa.create_engine(uri, echo=SQLALCHEMY_DEBUG,
implicit_returning=False,
poolclass=pool.NullPool)
poolclass=poolclass)
# TODO: there is a problem here: the code may cause an exception, but we
# immediately loose the 'new_engine', which should know about the
# encoding used in the exception string.
Expand Down

1 comment on commit 483d2e6

@mfrasca
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relates to #235

Please sign in to comment.