From 3d6130d8e92dc3fd63e7192908e122fe5ee45699 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 26 Jun 2021 09:55:00 -0400 Subject: turn pg provision error into a warning We haven't had any real cases of the PG "cant drop tables" condition since this error was first introduced; instead we seem to get it for a non-critical query during pool reconnect tests, and I have not been able to isolate what is causing it. Therefore turn the error into a new class of warning that can emit within the test suite without failing the test, so that if we do get a real PG drop timeout, the warning will be there to show us what the query was in which it was stuck. Change-Id: I1a9b3c4f7a25b7b9c1af722a721fc44ad5575b0f --- lib/sqlalchemy/testing/warnings.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sqlalchemy/testing/warnings.py') diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py index 8810dff5d..fd7748050 100644 --- a/lib/sqlalchemy/testing/warnings.py +++ b/lib/sqlalchemy/testing/warnings.py @@ -11,6 +11,15 @@ import warnings from . import assertions from .. import exc as sa_exc +from ..util.langhelpers import _warnings_warn + + +class SATestSuiteWarning(sa_exc.SAWarning): + """warning for a condition detected during tests that is non-fatal""" + + +def warn_test_suite(message): + _warnings_warn(message, category=SATestSuiteWarning) def setup_filters(): @@ -21,6 +30,7 @@ def setup_filters(): ) warnings.filterwarnings("error", category=sa_exc.SADeprecationWarning) warnings.filterwarnings("error", category=sa_exc.SAWarning) + warnings.filterwarnings("always", category=SATestSuiteWarning) # some selected deprecations... warnings.filterwarnings("error", category=DeprecationWarning) -- cgit v1.2.1