From: Mike Bayer Date: Thu, 9 Oct 2025 13:21:16 +0000 (-0400) Subject: remove suite name changes X-Git-Tag: rel_1_17_0~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c8f63c64cce20d8e8518d820beea2823e72074e;p=thirdparty%2Fsqlalchemy%2Falembic.git remove suite name changes the junit plugin doesnt need suites to have distinct names. it is actually merging correctly, the reason for lots of noise is that the different suites have lots of skips for the "backend" marked suites. will fix this in pytestplugin Change-Id: I4b73de0fbaca6840111d516565421e902c218f5d --- diff --git a/noxfile.py b/noxfile.py index 06caee33..7ce6a609 100644 --- a/noxfile.py +++ b/noxfile.py @@ -12,9 +12,9 @@ from packaging.version import parse as parse_version if True: sys.path.insert(0, ".") - from tools.toxnox import move_junit_file from tools.toxnox import tox_parameters from tools.toxnox import extract_opts + from tools.toxnox import OUR_PYTHON SQLA_REPO = os.environ.get( @@ -59,31 +59,16 @@ def filter_sqla( [PYTHON_VERSIONS, SQLALCHEMY_VERSIONS, DATABASES], filter_=filter_sqla, ) -def tests(session: nox.Session, sqlalchemy: str, database: str) -> None: +def tests( + session: nox.Session, python: str, sqlalchemy: str, database: str +) -> None: """Run the main test suite against one database at a time""" - _tests(session, sqlalchemy, [database]) - - -@nox.session() -@tox_parameters( - ["python", "sqlalchemy"], - [PYTHON_VERSIONS, SQLALCHEMY_VERSIONS], - filter_=filter_sqla, - base_tag="all", -) -def tests_alldb(session: nox.Session, sqlalchemy: str) -> None: - """Run the main test suite against all backends at once""" - - _tests(session, sqlalchemy, DATABASES) + _tests(session, sqlalchemy, [database], python=python) @nox.session(name="coverage") -@tox_parameters( - ["database"], - [DATABASES], - base_tag="coverage", -) +@tox_parameters(["database"], [DATABASES], base_tag="coverage") def coverage(session: nox.Session, database: str) -> None: """Run tests with coverage.""" @@ -94,6 +79,8 @@ def _tests( session: nox.Session, sqlalchemy: str, databases: Sequence[str], + *, + python: str = OUR_PYTHON, coverage: bool = False, ) -> None: if sqlalchemy == "sqla14": @@ -170,29 +157,20 @@ def _tests( posargs, opts = extract_opts(session.posargs, "generate-junit") if opts.generate_junit: - cmd.extend(["--junitxml", "junit-tmp.xml"]) + # produce individual junit files that are per-database (or as close + # as we can get). jenkins junit plugin will merge all the files... + if len(databases) == 1: + tag = "-".join(databases) + junitfile = f"junit-{tag}.xml" + else: + junitfile = "junit-general.xml" + cmd.extend(["--junitxml", junitfile]) cmd.extend(posargs) try: session.run(*cmd) finally: - # name the suites distinctly as well. this is so that when they get - # merged we can view each suite distinctly rather than them getting - # overwritten with each other since they are running the same tests - if opts.generate_junit: - # produce individual junit files that are per-database (or as close - # as we can get). jenkins junit plugin will merge all the files... - if len(databases) == 1: - tag = "-".join(databases) - junitfile = f"junit-{tag}.xml" - suite_name = f"pytest-{tag}" - else: - junitfile = "junit-general.xml" - suite_name = "pytest-general" - - move_junit_file("junit-tmp.xml", junitfile, suite_name) - # Run cleanup for oracle/mssql for database in databases: if database in ["oracle", "mssql"]: diff --git a/pyproject.toml b/pyproject.toml index a05d5aee..3b9bed6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ coverage = [ tests_postgresql = ["psycopg2>=2.7"] tests_mysql = ["mysqlclient>=1.4.0", "pymysql"] -tests_oracle = ["cx_oracle", "oracledb"] +tests_oracle = ["cx_oracle"] tests_mssql = ["pyodbc"] lint = [ diff --git a/tools/toxnox.py b/tools/toxnox.py index b64b71a7..497a689c 100644 --- a/tools/toxnox.py +++ b/tools/toxnox.py @@ -11,7 +11,6 @@ would fall back to defaults. from __future__ import annotations import collections -import os import re import sys from typing import Any @@ -216,13 +215,3 @@ def extract_opts(posargs: List[str], *args: str) -> Tuple[List[str], Any]: return [arg for arg in posargs if not extract(arg)], return_tuple( *return_args ) - - -def move_junit_file(tmpfilename: str, newname: str, suite_name: str): - import junitparser - - xml = junitparser.JUnitXml.fromfile(tmpfilename) - for suite in xml: - suite.name = suite_name - xml.write(newname) - os.unlink(tmpfilename)