X7ROOT File Manager
Current Path:
/lib/python2.7/site-packages/pymysql/tests
lib
/
python2.7
/
site-packages
/
pymysql
/
tests
/
📁
..
📄
__init__.py
(600 B)
📄
__init__.pyc
(773 B)
📄
__init__.pyo
(773 B)
📄
base.py
(2.64 KB)
📄
base.pyc
(3.64 KB)
📄
base.pyo
(3.64 KB)
📄
test_DictCursor.py
(4.51 KB)
📄
test_DictCursor.pyc
(5.21 KB)
📄
test_DictCursor.pyo
(5.21 KB)
📄
test_SSCursor.py
(3.83 KB)
📄
test_SSCursor.pyc
(3.29 KB)
📄
test_SSCursor.pyo
(3.29 KB)
📄
test_basic.py
(14.54 KB)
📄
test_basic.pyc
(14.09 KB)
📄
test_basic.pyo
(14.09 KB)
📄
test_connection.py
(23.71 KB)
📄
test_connection.pyc
(24.2 KB)
📄
test_connection.pyo
(24.16 KB)
📄
test_converters.py
(2.14 KB)
📄
test_converters.pyc
(3.51 KB)
📄
test_converters.pyo
(3.51 KB)
📄
test_cursor.py
(4.09 KB)
📄
test_cursor.pyc
(4.25 KB)
📄
test_cursor.pyo
(4.21 KB)
📄
test_err.py
(670 B)
📄
test_err.pyc
(1.29 KB)
📄
test_err.pyo
(1.29 KB)
📄
test_issues.py
(19.8 KB)
📄
test_issues.pyc
(19.88 KB)
📄
test_issues.pyo
(19.82 KB)
📄
test_load_local.py
(3.5 KB)
📄
test_load_local.pyc
(3.93 KB)
📄
test_load_local.pyo
(3.93 KB)
📄
test_nextset.py
(1.81 KB)
📄
test_nextset.pyc
(2.88 KB)
📄
test_nextset.pyo
(2.88 KB)
📄
test_optionfile.py
(737 B)
📄
test_optionfile.pyc
(1.25 KB)
📄
test_optionfile.pyo
(1.25 KB)
📁
thirdparty
Editing: base.py
import gc import json import os import re import warnings import unittest2 import pymysql from .._compat import CPYTHON class PyMySQLTestCase(unittest2.TestCase): # You can specify your test environment creating a file named # "databases.json" or editing the `databases` variable below. fname = os.path.join(os.path.dirname(__file__), "databases.json") if os.path.exists(fname): with open(fname) as f: databases = json.load(f) else: databases = [ {"host":"localhost","user":"root", "passwd":"","db":"test_pymysql", "use_unicode": True, 'local_infile': True}, {"host":"localhost","user":"root","passwd":"","db":"test_pymysql2"}] def mysql_server_is(self, conn, version_tuple): """Return True if the given connection is on the version given or greater. e.g.:: if self.mysql_server_is(conn, (5, 6, 4)): # do something for MySQL 5.6.4 and above """ server_version = conn.get_server_info() server_version_tuple = tuple( (int(dig) if dig is not None else 0) for dig in re.match(r'(\d+)\.(\d+)\.(\d+)', server_version).group(1, 2, 3) ) return server_version_tuple >= version_tuple def setUp(self): self.connections = [] for params in self.databases: self.connections.append(pymysql.connect(**params)) self.addCleanup(self._teardown_connections) def _teardown_connections(self): for connection in self.connections: connection.close() def safe_create_table(self, connection, tablename, ddl, cleanup=True): """create a table. Ensures any existing version of that table is first dropped. Also adds a cleanup rule to drop the table after the test completes. """ cursor = connection.cursor() with warnings.catch_warnings(): warnings.simplefilter("ignore") cursor.execute("drop table if exists `%s`" % (tablename,)) cursor.execute(ddl) cursor.close() if cleanup: self.addCleanup(self.drop_table, connection, tablename) def drop_table(self, connection, tablename): cursor = connection.cursor() with warnings.catch_warnings(): warnings.simplefilter("ignore") cursor.execute("drop table if exists `%s`" % (tablename,)) cursor.close() def safe_gc_collect(self): """Ensure cycles are collected via gc. Runs additional times on non-CPython platforms. """ gc.collect() if not CPYTHON: gc.collect()
Upload File
Create Folder