Use a file for sqlite in tests, in-memory seems to be seg-faulting
This commit is contained in:
parent
64750e31fc
commit
35ba2a6c1f
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from config import DefaultConfig
|
from config import DefaultConfig
|
||||||
|
|
||||||
|
@ -13,10 +14,13 @@ class FakeTransaction(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
TEST_DB_FILE = NamedTemporaryFile(delete=True)
|
||||||
|
|
||||||
|
|
||||||
class TestConfig(DefaultConfig):
|
class TestConfig(DefaultConfig):
|
||||||
TESTING = True
|
TESTING = True
|
||||||
|
|
||||||
DB_URI = os.environ.get('TEST_DATABASE_URI', 'sqlite:///:memory:')
|
DB_URI = os.environ.get('TEST_DATABASE_URI', 'sqlite:///{0}'.format(TEST_DB_FILE.name))
|
||||||
DB_CONNECTION_ARGS = {
|
DB_CONNECTION_ARGS = {
|
||||||
'threadlocals': True,
|
'threadlocals': True,
|
||||||
'autorollback': True
|
'autorollback': True
|
||||||
|
|
Reference in a new issue