projects
/
htsworkflow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use unittest2's module hooks for setting up the django environment.
[htsworkflow.git]
/
htsworkflow
/
frontend
/
inventory
/
test_inventory.py
diff --git
a/htsworkflow/frontend/inventory/test_inventory.py
b/htsworkflow/frontend/inventory/test_inventory.py
index 118c654aaf8463ee638d748414c5c620df9c0d67..86d37b7cbe7e740468f04df9380ae8fa82c98b35 100644
(file)
--- a/
htsworkflow/frontend/inventory/test_inventory.py
+++ b/
htsworkflow/frontend/inventory/test_inventory.py
@@
-1,6
+1,11
@@
import RDF
from django.test import TestCase
import RDF
from django.test import TestCase
+from django.test.utils import setup_test_environment, \
+ teardown_test_environment
+from django.db import connection
+from django.conf import settings
+
from django.contrib.auth.models import User
from django.core import urlresolvers
from django.contrib.auth.models import User
from django.core import urlresolvers
@@
-108,6
+113,15
@@
class InventoryTestCase(TestCase):
flowcells = [ str(x.uri) for x in targets]
return flowcells
flowcells = [ str(x.uri) for x in targets]
return flowcells
+OLD_DB = settings.DATABASES['default']['NAME']
+def setUpModule():
+ setup_test_environment()
+ connection.creation.create_test_db()
+
+def tearDownModule():
+ connection.creation.destroy_test_db(OLD_DB)
+ teardown_test_environment()
+
def suite():
from unittest2 import TestSuite, defaultTestLoader
suite = TestSuite()
def suite():
from unittest2 import TestSuite, defaultTestLoader
suite = TestSuite()