]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
test updates
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Oct 2025 20:01:03 +0000 (16:01 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Oct 2025 20:01:03 +0000 (16:01 -0400)
* remove .coveragerc since this produces warnings vs. pytest-cov
* use junitparser to rename the suite inside each junit file.  I think
  jenkins junit reads multiple files but they need to have distinct
  suite names to show up (or distinct test names, but we dont have that
  here).

Change-Id: Ic785969e7b41408eeb50028339c27c7e459cd8e0

.coveragerc [deleted file]
noxfile.py
pyproject.toml

diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644 (file)
index 1b33a56..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-[run]
-include=alembic/*
-
-[report]
-omit=alembic/testing/*
\ No newline at end of file
index 0403a8053f341cedf01d22a518e479182057feb4..1be66de98049478ff854a6dc98fd7157bd5c8cc6 100644 (file)
@@ -147,7 +147,7 @@ def _tests(
                 *nox.project.dependency_groups(pyproject, "tests_mysql")
             )
             cmd.extend(os.environ.get("TOX_MYSQL", "--db mysql").split())
-        elif databases == "oracle":
+        elif database == "oracle":
             # we'd like to use oracledb but SQLAlchemy 1.4 does not have
             # oracledb support...
             session.install(
@@ -159,7 +159,6 @@ def _tests(
                 session.env["NLS_LANG"] = os.environ.get("NLS_LANG")
             cmd.extend(os.environ.get("TOX_ORACLE", "--db oracle").split())
             cmd.extend("--write-idents db_idents.txt".split())
-
         elif database == "mssql":
             session.install(
                 *nox.project.dependency_groups(pyproject, "tests_mssql")
@@ -168,16 +167,34 @@ def _tests(
             cmd.extend("--write-idents db_idents.txt".split())
 
     posargs, opts = extract_opts(session.posargs, "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:
+        junitfile = f"junit-{databases[0]}.xml"
+        suite_name = f"pytest-{databases[0]}"
+    else:
+        junitfile = "junit-general.xml"
+        suite_name = "pytest-general"
+
     if opts.generate_junit:
-        if len(databases) == 1:
-            cmd.extend(["--junitxml", f"junit-{databases[0]}.xml"])
-        else:
-            cmd.extend(["--junitxml", "junit-general.xml"])
+        cmd.extend(["--junitxml", junitfile])
 
     cmd.extend(posargs)
 
     session.run(*cmd)
 
+    # 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:
+        import junitparser
+
+        xml = junitparser.JUnitXml.fromfile(junitfile)
+        for suite in xml:
+            suite.name = suite_name
+        xml.write(junitfile)
+
     # Run cleanup for oracle/mssql
     for database in databases:
         if database in ["oracle", "mssql"]:
index 1b0d58793870cb909fd53f3c1cab7b631041f95c..a05d5aee6d603764563fd83510b09dd68d4eda18 100644 (file)
@@ -56,7 +56,8 @@ tests = [
     "pytest>8,<8.4",
     "pytest-xdist",
     "black==25.1.0",  # for test_post_write.py
-    "tzdata"
+    "tzdata",
+    "junitparser"
 ]
 
 coverage = [