mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2026-03-13 08:00:02 +08:00
Squashed commit of the following: commit17fb6798cdAuthor: farcepest <farcepest@gmail.com> Date: Tue Oct 2 14:03:57 2012 -0400 Add a build status widget for Travis commit1cd83ef78eAuthor: farcepest <farcepest@gmail.com> Date: Tue Oct 2 13:59:48 2012 -0400 Rewrite the repository root README commit72848c84bcAuthor: farcepest <farcepest@gmail.com> Date: Tue Oct 2 13:50:00 2012 -0400 Somehow I missed this connection setup commit413c3b6623Author: farcepest <farcepest@gmail.com> Date: Tue Oct 2 13:19:09 2012 -0400 Giving Travis it's own database with utf8 charset in hopes this will fix the callproc test (which works everywhere else) commit400112e0c3Author: farcepest <farcepest@gmail.com> Date: Tue Oct 2 13:06:00 2012 -0400 Update the Travis config so that the tests use the correct database configuration file commitae94e44ed1Author: farcepest <farcepest@gmail.com> Date: Tue Oct 2 12:59:29 2012 -0400 Add Travis-specific configuration file commit3581603f45Merge:f42c369d0e96c7Author: farcepest <farcepest@gmail.com> Date: Tue Oct 2 12:58:00 2012 -0400 Merge branch 'master' into MySQLdb-1.2 Conflicts: MySQLdb/tests/test_MySQLdb_capabilities.py MySQLdb/tests/test_MySQLdb_dbapi20.py commitf42c369300Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:43:00 2012 -0400 Maybe a subshell will do the trick? commitfb346e1d40Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:35:50 2012 -0400 Travis can't build for Python 2.4 it seems, and the test still weren't all running commit2f661f0991Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:31:40 2012 -0400 OK, this should hopefully fix the build process for Travis commit899c3342b2Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:28:14 2012 -0400 More Travis fixes commit8f593def7bAuthor: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:19:39 2012 -0400 Fix test script due to source being down one level. commit1936b93cf0Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:14:38 2012 -0400 Test connection tweaks for Travis commit9bf8bcf894Merge:7ae4f55d551f8aAuthor: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:10:58 2012 -0400 Merge branch 'travis' into MySQLdb-1.2 commitd551f8a8d9Author: Andy Dustman <farcepest@gmail.com> Date: Mon Oct 1 13:05:25 2012 -0400 Initial Travis setup commit7ae4f5549bMerge:235d846c16bc33Author: farcepest <farcepest@gmail.com> Date: Thu Sep 27 12:49:07 2012 -0400 Merge remote-tracking branch 'origin/MySQLdb-1.2' into MySQLdb-1.2 commit235d8466ddAuthor: farcepest <farcepest@gmail.com> Date: Thu Sep 27 12:18:07 2012 -0400 History updates for 1.2.4b2 commit5fda4c2579Author: farcepest <farcepest@gmail.com> Date: Thu Sep 27 12:06:58 2012 -0400 Revert raise exc as value statements to raise exc, value since it breaks Python < 2.6. commit048b70d901Author: farcepest <farcepest@gmail.com> Date: Wed Sep 26 16:02:05 2012 -0400 Fix MySQLdb1-1 Exception format incompatible with previous versions Unfortunately, when I broke this, I broke the test at the same time. That should have been a red flag. commit162e9e4d84Author: Andy Dustman <farcepest@gmail.com> Date: Tue Sep 25 19:56:49 2012 -0400 General cleanups
87 lines
2.6 KiB
Python
87 lines
2.6 KiB
Python
import unittest
|
|
|
|
import _mysql
|
|
import MySQLdb
|
|
from MySQLdb.constants import FIELD_TYPE
|
|
from configdb import connection_factory
|
|
|
|
|
|
class TestDBAPISet(unittest.TestCase):
|
|
def test_set_equality(self):
|
|
self.assertTrue(MySQLdb.STRING == MySQLdb.STRING)
|
|
|
|
def test_set_inequality(self):
|
|
self.assertTrue(MySQLdb.STRING != MySQLdb.NUMBER)
|
|
|
|
def test_set_equality_membership(self):
|
|
self.assertTrue(FIELD_TYPE.VAR_STRING == MySQLdb.STRING)
|
|
|
|
def test_set_inequality_membership(self):
|
|
self.assertTrue(FIELD_TYPE.DATE != MySQLdb.STRING)
|
|
|
|
|
|
class CoreModule(unittest.TestCase):
|
|
"""Core _mysql module features."""
|
|
|
|
def test_NULL(self):
|
|
"""Should have a NULL constant."""
|
|
self.assertEqual(_mysql.NULL, 'NULL')
|
|
|
|
def test_version(self):
|
|
"""Version information sanity."""
|
|
self.assertTrue(isinstance(_mysql.__version__, str))
|
|
|
|
self.assertTrue(isinstance(_mysql.version_info, tuple))
|
|
self.assertEqual(len(_mysql.version_info), 5)
|
|
|
|
def test_client_info(self):
|
|
self.assertTrue(isinstance(_mysql.get_client_info(), str))
|
|
|
|
def test_thread_safe(self):
|
|
self.assertTrue(isinstance(_mysql.thread_safe(), int))
|
|
|
|
|
|
class CoreAPI(unittest.TestCase):
|
|
"""Test _mysql interaction internals."""
|
|
|
|
def setUp(self):
|
|
self.conn = connection_factory(use_unicode=True)
|
|
|
|
def tearDown(self):
|
|
self.conn.close()
|
|
|
|
def test_thread_id(self):
|
|
tid = self.conn.thread_id()
|
|
self.assertTrue(isinstance(tid, int),
|
|
"thread_id didn't return an int.")
|
|
|
|
self.assertRaises(TypeError, self.conn.thread_id, ('evil',),
|
|
"thread_id shouldn't accept arguments.")
|
|
|
|
def test_affected_rows(self):
|
|
self.assertEquals(self.conn.affected_rows(), 0,
|
|
"Should return 0 before we do anything.")
|
|
|
|
|
|
#def test_debug(self):
|
|
## FIXME Only actually tests if you lack SUPER
|
|
#self.assertRaises(MySQLdb.OperationalError,
|
|
#self.conn.dump_debug_info)
|
|
|
|
def test_charset_name(self):
|
|
self.assertTrue(isinstance(self.conn.character_set_name(), str),
|
|
"Should return a string.")
|
|
|
|
def test_host_info(self):
|
|
self.assertTrue(isinstance(self.conn.get_host_info(), str),
|
|
"Should return a string.")
|
|
|
|
def test_proto_info(self):
|
|
self.assertTrue(isinstance(self.conn.get_proto_info(), int),
|
|
"Should return an int.")
|
|
|
|
def test_server_info(self):
|
|
self.assertTrue(isinstance(self.conn.get_server_info(), str),
|
|
"Should return an str.")
|
|
|