From 48d22c040694bbc00bcd0e343770408648616bb6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 23 Sep 2019 16:33:04 -0400 Subject: [PATCH] move pytest assert rewrite to conftest.py this seems to be the best place to put this as it is guaranteed before the module is imported. this is for the benefit of 3rd party dialects that also would have this in their conftest.py, so that they don't have to do the "bootstrap" loading hack. Change-Id: Ieae5324240e04a7919df46f4fca03f8db7a2af81 --- lib/sqlalchemy/testing/plugin/pytestplugin.py | 2 -- test/conftest.py | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 7e144dd732..e0335c1357 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -72,8 +72,6 @@ def pytest_addoption(parser): def pytest_configure(config): - pytest.register_assert_rewrite("sqlalchemy.testing.assertions") - if hasattr(config, "slaveinput"): plugin_base.restore_important_follower_config(config.slaveinput) plugin_base.configure_follower(config.slaveinput["follower_ident"]) diff --git a/test/conftest.py b/test/conftest.py index cdabc97850..6f7fe460d3 100755 --- a/test/conftest.py +++ b/test/conftest.py @@ -9,6 +9,10 @@ installs SQLAlchemy's testing plugin into the local environment. import os import sys +import pytest + +pytest.register_assert_rewrite("sqlalchemy.testing.assertions") + if not sys.flags.no_user_site: # this is needed so that test scenarios like "python setup.py test" -- 2.47.3