Repository :
http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
---------------------------------------------------------------
commit e390e65434ac72f98b2a2feb1266009d5a3d1768
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Mar 1 11:41:39 2013 +0100
Switch the tests to use an in memory database and fix self.session
create_tables now returns a completely valid session, let's use it.
---------------------------------------------------------------
tests/__init__.py | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/tests/__init__.py b/tests/__init__.py
index 7c3cb54..8b43add 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,7 +2,7 @@
#-*- coding: utf-8 -*-
"""
- (c) 2012 - Copyright Pierre-Yves Chibon
+ (c) 2012-2013 - Copyright Pierre-Yves Chibon
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Distributed under License GPLv3 or later
@@ -46,8 +46,9 @@ sys.path.insert(0, os.path.join(os.path.dirname(
from fedocal.fedocallib import model, get_start_week
-DB_PATH = '%s/test.db' % (os.path.dirname(
- os.path.abspath(__file__)))
+#DB_PATH = '%s/test.db' % (os.path.dirname(
+ #os.path.abspath(__file__)))
+DB_PATH = ':memory:'
TODAY = get_start_week(date.today().year, date.today().month,
date.today().day) + timedelta(days=2)
@@ -64,10 +65,7 @@ class Modeltests(unittest.TestCase):
# pylint: disable=C0103
def setUp(self):
""" Set up the environnment, ran before every tests.
"""
- model.create_tables('sqlite:///%s' % DB_PATH)
- engine = create_engine('sqlite:///%s' % DB_PATH)
- scopedsession = scoped_session(sessionmaker(bind=engine))
- self.session = scopedsession
+ self.session = model.create_tables('sqlite:///%s' % DB_PATH)
# pylint: disable=C0103
def tearDown(self):