From 164067920ba7832e587a24725384789ab92bd55f Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 1 Dec 2010 17:22:55 +0100 Subject: [PATCH] Updated examples to work with pypy which has a incomplete sqlite3 in 1.4. Also disable a euc-kr test that does not work on pypy --- examples/flaskr/flaskr.py | 2 +- examples/minitwit/minitwit.py | 2 +- tests/flask_tests.py | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/flaskr/flaskr.py b/examples/flaskr/flaskr.py index 1df24293..69953555 100644 --- a/examples/flaskr/flaskr.py +++ b/examples/flaskr/flaskr.py @@ -10,7 +10,7 @@ :license: BSD, see LICENSE for more details. """ from __future__ import with_statement -import sqlite3 +from sqlite3 import dbapi2 as sqlite3 from contextlib import closing from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash diff --git a/examples/minitwit/minitwit.py b/examples/minitwit/minitwit.py index b740bc25..7726e9f4 100644 --- a/examples/minitwit/minitwit.py +++ b/examples/minitwit/minitwit.py @@ -10,7 +10,7 @@ """ from __future__ import with_statement import time -import sqlite3 +from sqlite3 import dbapi2 as sqlite3 from hashlib import md5 from datetime import datetime from contextlib import closing diff --git a/tests/flask_tests.py b/tests/flask_tests.py index c1cb95c2..9e68a7a3 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -29,6 +29,15 @@ sys.path.append(os.path.join(example_path, 'flaskr')) sys.path.append(os.path.join(example_path, 'minitwit')) +def has_encoding(name): + try: + import codecs + codecs.lookup(name) + return True + except LookupError: + return False + + # config keys used for the ConfigTestCase TEST_KEY = 'foo' SECRET_KEY = 'devkey' @@ -698,6 +707,9 @@ class JSONTestCase(unittest.TestCase): assert rv.status_code == 200 assert rv.data == u'정상처리'.encode('utf-8') + if not has_encoding('euc-kr'): + test_modified_url_encoding = None + class TemplatingTestCase(unittest.TestCase):