summaryrefslogtreecommitdiff
path: root/test/requirements.py
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/requirements.py
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/requirements.py')
-rw-r--r--test/requirements.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/test/requirements.py b/test/requirements.py
index c75a110c6..38b445542 100644
--- a/test/requirements.py
+++ b/test/requirements.py
@@ -403,7 +403,7 @@ class DefaultRequirements(SuiteRequirements):
@property
def sane_rowcount(self):
return skip_if(
- lambda: not self.db.dialect.supports_sane_rowcount,
+ lambda config: not config.db.dialect.supports_sane_rowcount,
"driver doesn't support 'sane' rowcount"
)
@@ -443,7 +443,7 @@ class DefaultRequirements(SuiteRequirements):
@property
def sane_multi_rowcount(self):
return skip_if(
- lambda: not self.db.dialect.supports_sane_multi_rowcount,
+ lambda config: not config.db.dialect.supports_sane_multi_rowcount,
"driver doesn't support 'sane' multi row count"
)
@@ -651,11 +651,11 @@ class DefaultRequirements(SuiteRequirements):
@property
def hstore(self):
- def check_hstore():
- if not against("postgresql"):
+ def check_hstore(config):
+ if not against(config, "postgresql"):
return False
try:
- self.db.execute("SELECT 'a=>1,a=>2'::hstore;")
+ config.db.execute("SELECT 'a=>1,a=>2'::hstore;")
return True
except:
return False
@@ -664,11 +664,11 @@ class DefaultRequirements(SuiteRequirements):
@property
def range_types(self):
- def check_range_types():
- if not against("postgresql+psycopg2"):
+ def check_range_types(config):
+ if not against(config, "postgresql+psycopg2"):
return False
try:
- self.db.execute("select '[1,2)'::int4range;")
+ config.db.execute("select '[1,2)'::int4range;")
# only supported in psycopg 2.5+
from psycopg2.extras import NumericRange
return True
@@ -684,7 +684,7 @@ class DefaultRequirements(SuiteRequirements):
@property
def oracle_test_dblink(self):
return skip_if(
- lambda: not self.config.file_config.has_option(
+ lambda config: not config.file_config.has_option(
'sqla_testing', 'oracle_db_link'),
"oracle_db_link option not specified in config"
)
@@ -698,7 +698,7 @@ class DefaultRequirements(SuiteRequirements):
as not present.
"""
- return skip_if(lambda: self.config.options.low_connections)
+ return skip_if(lambda config: config.options.low_connections)
@property
def skip_mysql_on_windows(self):
@@ -715,8 +715,8 @@ class DefaultRequirements(SuiteRequirements):
"""
return skip_if(
- lambda: util.py3k and
- self.config.options.enable_plugin_coverage,
+ lambda config: util.py3k and
+ config.options.has_coverage,
"Stability issues with coverage + py3k"
)
@@ -740,11 +740,15 @@ class DefaultRequirements(SuiteRequirements):
except ImportError:
return False
- def _has_mysql_on_windows(self):
- return against('mysql') and \
- self.db.dialect._detect_casing(self.db) == 1
+ @property
+ def mysql_fully_case_sensitive(self):
+ return only_if(self._has_mysql_fully_case_sensitive)
+
+ def _has_mysql_on_windows(self, config):
+ return against(config, 'mysql') and \
+ config.db.dialect._detect_casing(config.db) == 1
- def _has_mysql_fully_case_sensitive(self):
- return against('mysql') and \
- self.db.dialect._detect_casing(self.db) == 0
+ def _has_mysql_fully_case_sensitive(self, config):
+ return against(config, 'mysql') and \
+ config.db.dialect._detect_casing(config.db) == 0