]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add pyv to file template; use = for all custom args
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 15 Nov 2025 16:36:56 +0000 (11:36 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 15 Nov 2025 16:36:56 +0000 (11:36 -0500)
adding "test/" to pytest doesnt work because then we can't indicate
a specific set of test files.  use = for all sqlalchemy-custom
parameters instead to avoid [1]

[1] https://github.com/pytest-dev/pytest/issues/13913

Change-Id: I9eb5bbfac734fcb145fcf3ae58fcc55df6bb6e71

noxfile.py
tools/toxnox.py

index 0c55c3bd0cda10b9e1aed9cdab416e383834ee49..a548f44c9b1ed7e72f8b96c62b74f1b0c9b778c1 100644 (file)
@@ -78,8 +78,8 @@ def _setup_for_driver(
 
     # e.g. TOX_POSTGRESQL, TOX_MYSQL, etc.
     dburl_env = f"TOX_{basename.upper()}"
-    # e.g. --db postgresql, --db mysql, etc.
-    default_dburl = f"--db {basename}"
+    # e.g. --db=postgresql, --db=mysql, etc.
+    default_dburl = f"--db={basename}"
     cmd.extend(os.environ.get(dburl_env, default_dburl).split())
 
     # set up extra drivers using --dbdriver.   this first looks in
@@ -102,8 +102,9 @@ def _setup_for_driver(
     if greenlet:
         dbdrivers.update(extra_drivers["greenlet"])
 
-    for dbdriver in dbdrivers:
-        cmd.extend(["--dbdriver", dbdriver])
+    # use equals sign so that we avoid
+    # https://github.com/pytest-dev/pytest/issues/13913
+    cmd.extend([f"--dbdriver={dbdriver}" for dbdriver in dbdrivers])
 
 
 pyproject = nox.project.load_toml("pyproject.toml")
@@ -250,9 +251,7 @@ def _tests(
         if not timing_intensive:
             includes_excludes["m"].append("not timing_intensive")
 
-    # add test/ argument so that we avoid
-    # https://github.com/pytest-dev/pytest/issues/13913
-    cmd = ["python", "-m", "pytest", "test"]
+    cmd = ["python", "-m", "pytest"]
 
     cmd.extend(os.environ.get("TOX_WORKERS", "-n4").split())
 
@@ -296,7 +295,9 @@ def _tests(
     )
 
     if database in ["oracle", "mssql", "sqlite_file"]:
-        cmd.extend(["--write-idents", "db_idents.txt"])
+        # use equals sign so that we avoid
+        # https://github.com/pytest-dev/pytest/issues/13913
+        cmd.extend(["--write-idents=db_idents.txt"])
 
     cmd.extend(posargs)
 
@@ -340,7 +341,7 @@ def test_mypy(session: nox.Session) -> None:
         ["mypy"],
     )
 
-    cmd = ["pytest", "-m", "mypy", "test"]
+    cmd = ["pytest", "-m", "mypy"]
 
     session.run(*cmd, *posargs)
 
index 64bd298df570af75d637da3efdfe78b85d7bc3aa..295627a49c638dbc753c4c155f2a6a3f5b1b155d 100644 (file)
@@ -216,6 +216,10 @@ def apply_pytest_opts(
 ) -> list[str]:
     posargs, opts = extract_opts(session.posargs, "generate-junit")
 
+    if session.python and isinstance(session.python, str):
+        python_token = session.python.replace(".", "")
+        tokens.insert(0, python_token)
+
     file_suffix = "-".join(t for t in tokens if not t.startswith("_"))
 
     if coverage: