-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathterrain.py
44 lines (34 loc) · 1.2 KB
/
terrain.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
:copyright: (c) 2014 Building Energy Inc
:license: see LICENSE for more details.
"""
from django.core.management import call_command
from django.test.simple import DjangoTestSuiteRunner
from lettuce import after, before, step, world
from splinter.browser import Browser
from logging import getLogger
from selenium import webdriver
try:
from south.management.commands import patch_for_test_db_setup
except:
pass
logger = getLogger(__name__)
logger.info("Loading the terrain file...")
@before.runserver
def setup_database(actual_server):
'''
This will setup your database, sync it, and run migrations if you are using South.
It does this before the Test Django server is set up.
'''
logger.info("Setting up a test database...")
# Uncomment if you are using South
patch_for_test_db_setup()
world.test_runner = DjangoTestSuiteRunner(interactive=False)
DjangoTestSuiteRunner.setup_test_environment(world.test_runner)
world.created_db = DjangoTestSuiteRunner.setup_databases(world.test_runner)
call_command('syncdb', interactive=False, verbosity=0)
# Uncomment if you are using South
call_command('migrate', interactive=False, verbosity=0)
@before.all
def setup_browser():
world.browser = Browser('chrome')