summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin/pytestplugin.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-25 11:01:25 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-25 11:01:25 -0500
commita17cd6492ee6a9b54be49016ed2aac3f0bb00ef0 (patch)
treec27ead66a60c1a015efb958b5df9bf26c96e550a /lib/sqlalchemy/testing/plugin/pytestplugin.py
parent0a298e70518b6dfd47ba0190d9c4abf0f0d3f4ba (diff)
downloadsqlalchemy-a17cd6492ee6a9b54be49016ed2aac3f0bb00ef0.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/testing/plugin/pytestplugin.py')
-rw-r--r--lib/sqlalchemy/testing/plugin/pytestplugin.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
index 363a73ecc..6efeac504 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())