forked from eventray-archive/horus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
28 lines (19 loc) · 882 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from pkg_resources import resource_filename
import os
def pytest_sessionstart():
from py.test import config
# Only run database setup on master (in case of xdist/multiproc mode)
if not hasattr(config, 'slaveinput'):
from pyramid.config import Configurator
from horus.tests.models import Base
from paste.deploy.loadwsgi import appconfig
from sqlalchemy import engine_from_config
settings = appconfig('config:' + resource_filename(__name__,
'horus/tests/test.ini')
)
engine = engine_from_config(settings, prefix='sqlalchemy.')
print 'Creating the tables on the test database %s' % engine
config = Configurator(settings=settings)
config.scan('horus.models')
Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)