summaryrefslogtreecommitdiff
path: root/test/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-03-03 15:55:17 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-03-03 15:55:17 -0500
commitea05a2321819405020ead5184770d39a0b7948da (patch)
tree1f28366cba2c6c8d4614d0e91a404013137bcd37 /test/engine
parentbf89ca2e10ff1c38e76f78e2d11d7858a50df547 (diff)
downloadsqlalchemy-ea05a2321819405020ead5184770d39a0b7948da.tar.gz
- Support has been added for pytest to run tests. This runner
is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.
Diffstat (limited to 'test/engine')
-rw-r--r--test/engine/test_ddlevents.py7
-rw-r--r--test/engine/test_reflection.py23
2 files changed, 10 insertions, 20 deletions
diff --git a/test/engine/test_ddlevents.py b/test/engine/test_ddlevents.py
index 6cc652baf..b3f73f6b1 100644
--- a/test/engine/test_ddlevents.py
+++ b/test/engine/test_ddlevents.py
@@ -10,7 +10,6 @@ import sqlalchemy as tsa
from sqlalchemy import testing
from sqlalchemy.testing import engines
from sqlalchemy.testing import AssertsCompiledSQL, eq_
-from nose import SkipTest
from sqlalchemy.testing import fixtures
@@ -429,11 +428,9 @@ class DDLExecutionTest(fixtures.TestBase):
strings = ' '.join(str(x) for x in pg_mock.mock)
assert 'my_test_constraint' in strings
+ @testing.requires.sqlite
def test_ddl_execute(self):
- try:
- engine = create_engine('sqlite:///')
- except ImportError:
- raise SkipTest('Requires sqlite')
+ engine = create_engine('sqlite:///')
cx = engine.connect()
table = self.users
ddl = DDL('SELECT 1')
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py
index 8a1d7b70e..a46c7372e 100644
--- a/test/engine/test_reflection.py
+++ b/test/engine/test_reflection.py
@@ -829,12 +829,12 @@ class ReflectionTest(fixtures.TestBase, ComparesTables):
e = engines.testing_engine(options={"poolclass": AssertionPool})
fn(e)
- @testing.uses_deprecated
+ @testing.uses_deprecated()
def test_reflect_uses_bind_constructor_conn(self):
self._test_reflect_uses_bind(lambda e: MetaData(e.connect(),
reflect=True))
- @testing.uses_deprecated
+ @testing.uses_deprecated()
def test_reflect_uses_bind_constructor_engine(self):
self._test_reflect_uses_bind(lambda e: MetaData(e, reflect=True))
@@ -1120,12 +1120,6 @@ class SchemaManipulationTest(fixtures.TestBase):
class UnicodeReflectionTest(fixtures.TestBase):
@classmethod
def setup_class(cls):
- # trigger mysql _server_casing check...
- testing.db.connect().close()
-
- cls.bind = bind = engines.utf8_engine(
- options={'convert_unicode': True})
-
cls.metadata = metadata = MetaData()
no_multibyte_period = set([
@@ -1152,7 +1146,7 @@ class UnicodeReflectionTest(fixtures.TestBase):
names = no_multibyte_period
# mysql can't handle casing usually
elif testing.against("mysql") and \
- not testing.requires._has_mysql_fully_case_sensitive():
+ not testing.requires.mysql_fully_case_sensitive.enabled:
names = no_multibyte_period.union(no_case_sensitivity)
# mssql + pyodbc + freetds can't compare multibyte names to
# information_schema.tables.table_name
@@ -1170,18 +1164,17 @@ class UnicodeReflectionTest(fixtures.TestBase):
)
schema.Index(ixname, t.c[cname])
- metadata.create_all(bind)
+ metadata.create_all(testing.db)
cls.names = names
@classmethod
def teardown_class(cls):
- cls.metadata.drop_all(cls.bind, checkfirst=False)
- cls.bind.dispose()
+ cls.metadata.drop_all(testing.db, checkfirst=False)
@testing.requires.unicode_connections
def test_has_table(self):
for tname, cname, ixname in self.names:
- assert self.bind.has_table(tname), "Can't detect name %s" % tname
+ assert testing.db.has_table(tname), "Can't detect name %s" % tname
@testing.requires.unicode_connections
def test_basic(self):
@@ -1190,7 +1183,7 @@ class UnicodeReflectionTest(fixtures.TestBase):
# (others?) expect non-unicode strings in result sets/bind
# params
- bind = self.bind
+ bind = testing.db
names = set([rec[0] for rec in self.names])
reflected = set(bind.table_names())
@@ -1217,7 +1210,7 @@ class UnicodeReflectionTest(fixtures.TestBase):
@testing.requires.unicode_connections
def test_get_names(self):
- inspector = inspect(self.bind)
+ inspector = inspect(testing.db)
names = dict(
(tname, (cname, ixname)) for tname, cname, ixname in self.names
)