summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/testing/assertsql.py15
-rw-r--r--lib/sqlalchemy/testing/config.py4
-rw-r--r--lib/sqlalchemy/testing/exclusions.py5
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py3
-rw-r--r--lib/sqlalchemy/testing/plugin/pytestplugin.py3
5 files changed, 25 insertions, 5 deletions
diff --git a/lib/sqlalchemy/testing/assertsql.py b/lib/sqlalchemy/testing/assertsql.py
index 6a654df1e..3a8f45918 100644
--- a/lib/sqlalchemy/testing/assertsql.py
+++ b/lib/sqlalchemy/testing/assertsql.py
@@ -182,10 +182,13 @@ class CompiledSQL(SQLMatchRule):
def _failure_message(self, expected_params):
return (
- "Testing for compiled statement %r partial params %r, "
+ "Testing for compiled statement %r partial params %s, "
"received %%(received_statement)r with params "
"%%(received_parameters)r"
- % (self.statement.replace("%", "%%"), expected_params)
+ % (
+ self.statement.replace("%", "%%"),
+ repr(expected_params).replace("%", "%%"),
+ )
)
@@ -199,9 +202,13 @@ class RegexSQL(CompiledSQL):
def _failure_message(self, expected_params):
return (
- "Testing for compiled statement ~%r partial params %r, "
+ "Testing for compiled statement ~%r partial params %s, "
"received %%(received_statement)r with params "
- "%%(received_parameters)r" % (self.orig_regex, expected_params)
+ "%%(received_parameters)r"
+ % (
+ self.orig_regex.replace("%", "%%"),
+ repr(expected_params).replace("%", "%%"),
+ )
)
def _compare_sql(self, execute_observed, received_statement):
diff --git a/lib/sqlalchemy/testing/config.py b/lib/sqlalchemy/testing/config.py
index 8262142ec..ae84a7878 100644
--- a/lib/sqlalchemy/testing/config.py
+++ b/lib/sqlalchemy/testing/config.py
@@ -89,6 +89,10 @@ def fixture(*arg, **kw):
return _fixture_functions.fixture(*arg, **kw)
+def get_current_test_name():
+ return _fixture_functions.get_current_test_name()
+
+
class Config(object):
def __init__(self, db, db_opts, options, file_config):
self._set_name(db)
diff --git a/lib/sqlalchemy/testing/exclusions.py b/lib/sqlalchemy/testing/exclusions.py
index 86f3b7aac..97cee7e27 100644
--- a/lib/sqlalchemy/testing/exclusions.py
+++ b/lib/sqlalchemy/testing/exclusions.py
@@ -141,7 +141,10 @@ class compound(object):
for skip in self.skips:
if self._check_combinations(combination, skip) and skip(cfg):
- msg = "'%s' : %s" % (fn.__name__, skip._as_string(cfg))
+ msg = "'%s' : %s" % (
+ config.get_current_test_name(),
+ skip._as_string(cfg),
+ )
config.skip_test(msg)
try:
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index be1984c9e..33967ec15 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -730,6 +730,9 @@ class FixtureFunctions(ABC):
def fixture(self, *arg, **kw):
raise NotImplementedError()
+ def get_current_test_name(self):
+ raise NotImplementedError()
+
_fixture_fn_class = None
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
index 2f7df97fa..44fccf28d 100644
--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
+++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
@@ -412,3 +412,6 @@ class PytestFixtureFunctions(plugin_base.FixtureFunctions):
def fixture(self, *arg, **kw):
return pytest.fixture(*arg, **kw)
+
+ def get_current_test_name(self):
+ return os.environ.get("PYTEST_CURRENT_TEST")