From: Mike Bayer Date: Sat, 15 Nov 2025 16:36:56 +0000 (-0500) Subject: add pyv to file template; use = for all custom args X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8383e3f48c900fa248f026218fed0cea5ad0e6a5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add pyv to file template; use = for all custom args 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 --- diff --git a/noxfile.py b/noxfile.py index 0c55c3bd0c..a548f44c9b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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) diff --git a/tools/toxnox.py b/tools/toxnox.py index 64bd298df5..295627a49c 100644 --- a/tools/toxnox.py +++ b/tools/toxnox.py @@ -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: