From: Mike Bayer Date: Mon, 23 Sep 2019 20:33:04 +0000 (-0400) Subject: move pytest assert rewrite to conftest.py X-Git-Tag: rel_1_4_0b1~717 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48d22c040694bbc00bcd0e343770408648616bb6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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 --- 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"