[fedocal] master: Fix the test of test_formatweek by fixing the date itself (5b3b98a)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 5b3b98acc0949ea0d41c2bc6c9c11438060916b5
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Mar 2 11:20:42 2013 +0100
Fix the test of test_formatweek by fixing the date itself
>---------------------------------------------------------------
tests/test_fedora_calendar.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test_fedora_calendar.py b/tests/test_fedora_calendar.py
index 45cf349..79bcf94 100644
--- a/tests/test_fedora_calendar.py
+++ b/tests/test_fedora_calendar.py
@@ -40,7 +40,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..'))
from fedocallib.fedora_calendar import FedocalCalendar
-from tests import Modeltests
+from tests import Modeltests, TODAY
class FedocalCalendartests(Modeltests):
@@ -61,7 +61,7 @@ class FedocalCalendartests(Modeltests):
def test_formatweek(self):
""" Test the formatweek function. """
- today = date.today()
+ today = TODAY
cal = FedocalCalendar(today.year, today.month, today.day)
self.assertEqual(cal.formatweek([(1, 1), (2, 2)]),
'<tr><td class="tue">1</td><td class="wed">2</td></tr>')
11 years, 1 month
[fedocal] master: By default, SQLAlchemy should not be on debug mode (4b6f63c)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 4b6f63cde6b2757495394c10b9070c08db8c3f3a
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Mar 2 11:20:21 2013 +0100
By default, SQLAlchemy should not be on debug mode
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 160f088..4d1dbfa 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -43,7 +43,7 @@ from sqlalchemy.sql import and_
BASE = declarative_base()
-def create_tables(db_url, alembic_ini=None, debug=True):
+def create_tables(db_url, alembic_ini=None, debug=False):
""" Create the tables in the database using the information from the
url obtained.
11 years, 1 month
[fedocal] master: Finally we don't use freezegun (4093e34)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 4093e3470100caeb12f8d3dc9ef719e29ce0ca51
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Mar 2 11:19:56 2013 +0100
Finally we don't use freezegun
>---------------------------------------------------------------
requirements.txt | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 7b4bda4..822a686 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,7 +3,6 @@
alembic
flask-wtf
flask
-freezegun
kitchen
python-dateutil <= 1.5
python-fedora
11 years, 1 month
[fedocal] master: Add freezegun in the list of building dependencies (f82e582)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit f82e582882a5559dde1c67b41fa84113eba1d6aa
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Mar 2 10:24:23 2013 +0100
Add freezegun in the list of building dependencies
Reorganize the list by alphabetical order
>---------------------------------------------------------------
requirements.txt | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 52a2ee1..7b4bda4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,12 +1,13 @@
# Used for when working from a virtualenv.
# Use this file by running "$ pip install -r requirements.txt"
+alembic
+flask-wtf
flask
-sqlalchemy
-wtforms
-Flask-wtf
-vobject
+freezegun
kitchen
+python-dateutil <= 1.5
python-fedora
pytz
-alembic
-python-dateutil <= 1.5
+sqlalchemy
+vobject
+wtforms
11 years, 1 month
[fedocal] master: Fix import and have the flask tests running with the in memory database (cd8fd7a)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit cd8fd7abfa0647e9c3c8bb37bad2735ad8f7e2fc
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Mar 1 11:42:35 2013 +0100
Fix import and have the flask tests running with the in memory database
>---------------------------------------------------------------
tests/test_flask.py | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/tests/test_flask.py b/tests/test_flask.py
index eb05dce..02431b7 100644
--- a/tests/test_flask.py
+++ b/tests/test_flask.py
@@ -38,19 +38,17 @@ import os
from datetime import date
sys.path.insert(0, os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '..', '..'))
+ os.path.abspath(__file__)), '..'))
import fedocal
import fedocal.fedocallib as fedocallib
-from tests import Modeltests, DB_PATH, FakeUser
+from tests import Modeltests, FakeUser
# pylint: disable=E1103
class Flasktests(Modeltests):
""" Flask application tests. """
- session = None
-
def __setup_db(self):
""" Add a calendar and some meetings so that we can play with
something. """
@@ -64,8 +62,7 @@ class Flasktests(Modeltests):
super(Flasktests, self).setUp()
fedocal.APP.config['TESTING'] = True
- fedocal.SESSION = fedocallib.create_session(
- 'sqlite:///%s' % DB_PATH)
+ fedocal.SESSION = self.session
self.app = fedocal.APP.test_client()
def test_index_empty(self):
11 years, 1 month
[fedocal] master: Fix imports and make the API tests running with the in memory database (2867c00)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 2867c008dbc726bc94aee866d7b62d12149145d8
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Mar 1 11:42:17 2013 +0100
Fix imports and make the API tests running with the in memory database
>---------------------------------------------------------------
tests/test_flask_api.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/test_flask_api.py b/tests/test_flask_api.py
index 93a4daf..d777c4a 100644
--- a/tests/test_flask_api.py
+++ b/tests/test_flask_api.py
@@ -37,11 +37,12 @@ import os
from datetime import timedelta
sys.path.insert(0, os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '..', '..'))
+ os.path.abspath(__file__)), '..'))
import fedocal
+import fedocal.api
import fedocal.fedocallib as fedocallib
-from tests import Modeltests, DB_PATH, TODAY
+from tests import Modeltests, TODAY
# pylint: disable=E1103
@@ -61,8 +62,8 @@ class FlaskApitests(Modeltests):
super(FlaskApitests, self).setUp()
fedocal.APP.config['TESTING'] = True
- fedocal.APP.config['DB_URL'] = DB_PATH
fedocal.SESSION = self.session
+ fedocal.api.SESSION = self.session
self.app = fedocal.APP.test_client()
def test_api(self):
11 years, 1 month
[fedocal] master: Switch the tests to use an in memory database and fix self.session (e390e65)
by Pierre-YvesChibon
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):
11 years, 1 month
[fedocal] master: pep8 clean up (989b0f8)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 989b0f8c7da257f808335ec56e7b3053fbd1827b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Mar 1 11:40:40 2013 +0100
pep8 clean up
>---------------------------------------------------------------
fedocal/__init__.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/fedocal/__init__.py b/fedocal/__init__.py
index 6d31fb2..2fdca1d 100644
--- a/fedocal/__init__.py
+++ b/fedocal/__init__.py
@@ -55,7 +55,6 @@ if 'FEDOCAL_CONFIG' in os.environ:
SESSION = fedocallib.create_session(APP.config['DB_URL'])
-
import fedocal.api
11 years, 1 month
[fedocal] master: Have the create_table function return a valid scoped session (47592aa)
by Pierre-YvesChibon
Repository : http://git.fedorahosted.org/cgit/fedocal.git
On branch : master
>---------------------------------------------------------------
commit 47592aaaf0ad4d74ba57b497f4f2ff0bc0f342cb
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Mar 1 11:39:57 2013 +0100
Have the create_table function return a valid scoped session
>---------------------------------------------------------------
fedocal/fedocallib/model.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py
index 24e218c..160f088 100644
--- a/fedocal/fedocallib/model.py
+++ b/fedocal/fedocallib/model.py
@@ -36,13 +36,14 @@ from sqlalchemy import (
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
+from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import relation as relationship
from sqlalchemy.sql import and_
BASE = declarative_base()
-def create_tables(db_url, alembic_ini=None, debug=False):
+def create_tables(db_url, alembic_ini=None, debug=True):
""" Create the tables in the database using the information from the
url obtained.
@@ -67,8 +68,8 @@ def create_tables(db_url, alembic_ini=None, debug=False):
alembic_cfg = Config(alembic_ini)
command.stamp(alembic_cfg, "head")
- sessionmak = sessionmaker(bind=engine)
- return sessionmak()
+ scopedsession = scoped_session(sessionmaker(bind=engine))
+ return scopedsession
class Calendar(BASE):
11 years, 1 month