]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
join to existing mark expr with "and"
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Jan 2022 16:01:25 +0000 (11:01 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Jan 2022 16:01:25 +0000 (11:01 -0500)
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

index 363a73eccf169f9b30918aca0de767897b894424..6efeac5049020e044b1620cd1c2da6b5d6c5f952 100644 (file)
@@ -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())