From 90acad67f9add84cfce4bcb996cae2d6a16b0ae0 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sun, 1 Apr 2012 19:39:26 +0200 Subject: [PATCH] make tests run on python 2.7 also --- budget/tests.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/budget/tests.py b/budget/tests.py index 5e03cde..85d9f39 100644 --- a/budget/tests.py +++ b/budget/tests.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- -import os -import tempfile -import unittest2 as unittest +try: + import unittest2 as unittest +except ImportError: + import unittest # NOQA + import base64 import json @@ -10,13 +12,14 @@ from flask import session import run import models + class TestCase(unittest.TestCase): def setUp(self): run.app.config['TESTING'] = True run.app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///memory" - run.app.config['CSRF_ENABLED'] = False # simplify the tests + run.app.config['CSRF_ENABLED'] = False # simplify the tests self.app = run.app.test_client() models.db.init_app(run.app) @@ -51,6 +54,7 @@ class TestCase(unittest.TestCase): password=name, contact_email="%s@notmyidea.org" % name)) models.db.session.commit() + class BudgetTestCase(TestCase): def test_notifications(self):