summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/warnings.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-08-17 17:24:27 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-16 12:31:05 -0400
commit7e864fc7b1b950760cbf02e6dcd5aa5aac267400 (patch)
tree2382b016c3eb82ae463719cc948f45ccd2a226a2 /lib/sqlalchemy/testing/warnings.py
parent8ebc8184392e20727748cd1405245e527f17e111 (diff)
downloadsqlalchemy-7e864fc7b1b950760cbf02e6dcd5aa5aac267400.tar.gz
Create a framework to allow all SQLALCHEMY_WARN_20 to pass
As the test suite has widespread use of many patterns that are deprecated, enable SQLALCHEMY_WARN_20 globally for the test suite but then break the warnings filter out into a whole list of all the individual warnings we are looking for. this way individual changesets can target a specific class of warning, as many of these warnings will indivdidually affect dozens of files and potentially hundreds of lines of code. Many warnings are also resolved here as this patch started out that way. From this point forward there should be changesets that target a subset of the warnings at a time. For expediency, updates some migration 2.0 docs for ORM as well. Change-Id: I98b8defdf7c37b818b3824d02f7668e3f5f31c94
Diffstat (limited to 'lib/sqlalchemy/testing/warnings.py')
-rw-r--r--lib/sqlalchemy/testing/warnings.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py
index 298b20c11..de5db6467 100644
--- a/lib/sqlalchemy/testing/warnings.py
+++ b/lib/sqlalchemy/testing/warnings.py
@@ -43,6 +43,80 @@ def setup_filters():
message=r"^The (Sybase|firebird) dialect is deprecated and will be",
)
+ # 2.0 deprecation warnings, which we will want to have all of these
+ # be "error" however for I98b8defdf7c37b818b3824d02f7668e3f5f31c94
+ # we are moving one at a time
+ for msg in [
+ #
+ # Core execution
+ #
+ r"The (?:Executable|Engine)\.(?:execute|scalar)\(\) function",
+ r"The current statement is being autocommitted using implicit "
+ "autocommit,",
+ r"The connection.execute\(\) method in SQLAlchemy 2.0 will accept "
+ "parameters as a single dictionary or a single sequence of "
+ "dictionaries only.",
+ r"The Connection.connect\(\) function/method is considered legacy",
+ r".*DefaultGenerator.execute\(\)",
+ #
+ # result sets
+ #
+ r"The Row.keys\(\) function/method",
+ r"Using non-integer/slice indices on Row ",
+ #
+ # Core SQL constructs
+ #
+ r"The FromClause\.select\(\).whereclause parameter is deprecated",
+ r"Set functions such as union\(\), union_all\(\), extract\(\),",
+ r"The legacy calling style of select\(\) is deprecated and will be "
+ "removed",
+ r"The FromClause.select\(\) method will no longer accept keyword "
+ "arguments in version 2.0",
+ r"The Join.select\(\) method will no longer accept keyword arguments "
+ "in version 2.0.",
+ r"The \"whens\" argument to case\(\) is now passed",
+ r"The Join.select\(\).whereclause parameter is deprecated",
+ #
+ # DML
+ #
+ r"The (?:update|delete).whereclause parameter will be removed in "
+ "SQLAlchemy 2.0.",
+ r"The (?:insert|update).values parameter will be removed in "
+ "SQLAlchemy 2.0.",
+ r"The update.preserve_parameter_order parameter will be removed in "
+ "SQLAlchemy 2.0.",
+ r"Passing dialect keyword arguments directly to the "
+ "(?:Insert|Update|Delete) constructor",
+ #
+ # ORM configuration
+ #
+ r"Calling the mapper\(\) function directly outside of a "
+ "declarative registry",
+ r"The ``declarative_base\(\)`` function is now available ",
+ r"The ``has_inherited_table\(\)`` function is now available",
+ r"The ``bind`` argument to declarative_base is deprecated and will "
+ "be removed in SQLAlchemy 2.0.",
+ #
+ # ORM Query
+ #
+ r"The Query\.get\(\) function",
+ r"The Query\.from_self\(\) function",
+ #
+ # ORM Session
+ #
+ r"The Session.autocommit parameter is deprecated ",
+ r".*object is being merged into a Session along the backref "
+ "cascade path",
+ r"Passing bind arguments to Session.execute\(\) as keyword arguments",
+ r"The Session.transaction function/method",
+ r"The merge_result\(\) method is superseded by the "
+ r"merge_frozen_result\(\)",
+ r"The Session.begin.subtransactions flag is deprecated",
+ ]:
+ warnings.filterwarnings(
+ "ignore", message=msg, category=sa_exc.RemovedIn20Warning,
+ )
+
try:
import pytest
except ImportError: