From a17cd6492ee6a9b54be49016ed2aac3f0bb00ef0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 25 Jan 2022 11:01:25 -0500 Subject: [PATCH] join to existing mark expr with "and" ca48f461b2dcac2970829e4e0 considered an existing mark expression plus legacy tags to be an error condition; however these can be joined by "and" and will in our use case do the right thing. The github action scripts make use of legacy tags. We can change that also but I want to just make sure this combination works fully as well. Change-Id: Ifc506de3dd961c01d68d594ec2f5b2c9a0bbad31 --- lib/sqlalchemy/testing/plugin/pytestplugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index 363a73eccf..6efeac5049 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -70,16 +70,16 @@ def pytest_addoption(parser): def pytest_configure(config): if plugin_base.exclude_tags or plugin_base.include_tags: - if config.option.markexpr: - raise ValueError( - "Can't combine explicit pytest marks with legacy options " - "such as --backend-only, --exclude-tags, etc. " - ) - config.option.markexpr = " and ".join( + new_expr = " and ".join( list(plugin_base.include_tags) + [f"not {tag}" for tag in plugin_base.exclude_tags] ) + if config.option.markexpr: + config.option.markexpr += f" and {new_expr}" + else: + config.option.markexpr = new_expr + if config.pluginmanager.hasplugin("xdist"): config.pluginmanager.register(XDistHooks()) -- 2.47.2