From 0e2dbef519dab203b9ef4da39ba30f92390cf976 Mon Sep 17 00:00:00 2001 From: adustman Date: Sun, 8 Mar 2009 16:34:49 +0000 Subject: [PATCH] Short-term fix for bug #2671682. Make tests a little more parallel to trunk version. Add nose.collector as test_suite --- MySQLdb/MySQLdb/connections.py | 2 +- MySQLdb/MySQLdb/cursors.py | 2 -- MySQLdb/{test_capabilities.py => capabilities.py} | 0 MySQLdb/metadata.cfg | 6 +++--- MySQLdb/setup.cfg | 3 +++ MySQLdb/test_MySQLdb_capabilities.py | 12 ++++++++++-- 6 files changed, 17 insertions(+), 8 deletions(-) rename MySQLdb/{test_capabilities.py => capabilities.py} (100%) diff --git a/MySQLdb/MySQLdb/connections.py b/MySQLdb/MySQLdb/connections.py index 92ca8ee..22274e0 100644 --- a/MySQLdb/MySQLdb/connections.py +++ b/MySQLdb/MySQLdb/connections.py @@ -32,7 +32,7 @@ def defaulterrorhandler(connection, cursor, errorclass, errorvalue): connection.messages.append(error) del cursor del connection - raise errorclass(errorvalue) + raise errorclass, errorvalue class Connection(_mysql.connection): diff --git a/MySQLdb/MySQLdb/cursors.py b/MySQLdb/MySQLdb/cursors.py index 920bc19..95d98c1 100644 --- a/MySQLdb/MySQLdb/cursors.py +++ b/MySQLdb/MySQLdb/cursors.py @@ -212,10 +212,8 @@ class BaseCursor(object): except TypeError, msg: if msg.args[0] in ("not enough arguments for format string", "not all arguments converted"): - self.messages.append((ProgrammingError, msg.args[0])) self.errorhandler(self, ProgrammingError, msg.args[0]) else: - self.messages.append((TypeError, msg)) self.errorhandler(self, TypeError, msg) except: from sys import exc_info diff --git a/MySQLdb/test_capabilities.py b/MySQLdb/capabilities.py similarity index 100% rename from MySQLdb/test_capabilities.py rename to MySQLdb/capabilities.py diff --git a/MySQLdb/metadata.cfg b/MySQLdb/metadata.cfg index e72d671..19fe583 100644 --- a/MySQLdb/metadata.cfg +++ b/MySQLdb/metadata.cfg @@ -1,5 +1,5 @@ [metadata] -version: 1.2.3 +version: 1.2.3b1 version_info: (1,2,3,'beta',1) description: Python interface to MySQL long_description: @@ -16,8 +16,8 @@ long_description: \n - Thread-friendliness (threads will not block each other) \n - MySQL-3.23 through 5.0 and Python-2.3 through 2.5 are currently - supported. + MySQL-3.23 through 5.0 and Python-2.3 through 2.6 are currently + supported. Python-3.0 will be supported in a future release. \n MySQLdb is `Free Software`_. \n diff --git a/MySQLdb/setup.cfg b/MySQLdb/setup.cfg index 132666b..5b21f6d 100644 --- a/MySQLdb/setup.cfg +++ b/MySQLdb/setup.cfg @@ -1,3 +1,6 @@ +[test] +test_suite = nose.collector + [build_ext] ## Only uncomment/set these if the default configuration doesn't work ## Also see http://docs.python.org/dist/setup-config.html diff --git a/MySQLdb/test_MySQLdb_capabilities.py b/MySQLdb/test_MySQLdb_capabilities.py index 5f6321d..d4a3761 100644 --- a/MySQLdb/test_MySQLdb_capabilities.py +++ b/MySQLdb/test_MySQLdb_capabilities.py @@ -1,12 +1,12 @@ #!/usr/bin/env python -import test_capabilities +import capabilities import unittest import MySQLdb import warnings warnings.filterwarnings('error') -class test_MySQLdb(test_capabilities.DatabaseTest): +class test_MySQLdb(capabilities.DatabaseTest): db_module = MySQLdb connect_args = () @@ -72,6 +72,14 @@ class test_MySQLdb(test_capabilities.DatabaseTest): self.check_data_integrity( ('col1 char(1)','col2 char(1)'), generator) + + def test_bug_2671682(self): + from MySQLdb.constants import ER + try: + self.cursor.execute("describe some_non_existent_table"); + except self.connection.ProgrammingError, msg: + self.failUnless(msg[0] == ER.NO_SUCH_TABLE) + if __name__ == '__main__': if test_MySQLdb.leak_test: