Skip to content

Commit b54aee5

Browse files
committed
no need to rename suites
Change-Id: I343e5677ca2e896d85cb92a76be08a11f9cc62a9
1 parent 2f58936 commit b54aee5

2 files changed

Lines changed: 15 additions & 37 deletions

File tree

noxfile.py

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
sys.path.insert(0, ".")
1414
from tools.toxnox import tox_parameters
1515
from tools.toxnox import extract_opts
16-
from tools.toxnox import move_junit_file
1716

1817

1918
PYTHON_VERSIONS = [
@@ -43,7 +42,7 @@
4342
nox.options.tags = ["py-generic-memory-dbm"]
4443

4544

46-
def pifpaf(
45+
def _pifpaf(
4746
cmd: list[str],
4847
module: str,
4948
*,
@@ -156,12 +155,12 @@ def _tests(
156155
)
157156
)
158157

159-
pifpaf(
158+
_pifpaf(
160159
pifpaf_cmd,
161160
"memcached",
162161
port=str(next(ports)),
163162
)
164-
pifpaf(
163+
_pifpaf(
165164
pifpaf_cmd,
166165
"memcached",
167166
port_env="TOX_DOGPILE_TLS_PORT",
@@ -177,20 +176,20 @@ def _tests(
177176
session.install(
178177
*nox.project.dependency_groups(pyproject, "tests_redis")
179178
)
180-
pifpaf(pifpaf_cmd, "redis", port=str(next(ports)))
179+
_pifpaf(pifpaf_cmd, "redis", port=str(next(ports)))
181180
backend_cmd.append("tests/cache/test_redis_backend.py")
182181
case "valkey":
183182
session.install(
184183
*nox.project.dependency_groups(pyproject, "tests_valkey")
185184
)
186-
pifpaf(pifpaf_cmd, "valkey", port=str(next(ports)))
185+
_pifpaf(pifpaf_cmd, "valkey", port=str(next(ports)))
187186
backend_cmd.append("tests/cache/test_valkey_backend.py")
188187
case "redis_sentinel":
189188
session.install(
190189
*nox.project.dependency_groups(pyproject, "tests_redis")
191190
)
192191

193-
pifpaf(
192+
_pifpaf(
194193
pifpaf_cmd,
195194
"redis",
196195
port=str(next(ports)),
@@ -206,7 +205,7 @@ def _tests(
206205
session.install(
207206
*nox.project.dependency_groups(pyproject, "tests_valkey")
208207
)
209-
pifpaf(
208+
_pifpaf(
210209
pifpaf_cmd,
211210
"valkey",
212211
port=str(next(ports)),
@@ -224,24 +223,14 @@ def _tests(
224223
posargs, opts = extract_opts(session.posargs, "generate-junit")
225224

226225
if opts.generate_junit:
227-
cmd.extend(["--junitxml", "junit-tmp.xml"])
228-
229-
try:
230-
session.run(*pifpaf_cmd, *cmd, *backend_cmd, *posargs)
231-
finally:
232-
# name the suites distinctly as well. this is so that when they
233-
# get merged we can view each suite distinctly rather than them
234-
# getting overwritten with each other since they are running the
235-
# same tests
236-
if opts.generate_junit:
237-
# produce individual junit files that are per-database (or as
238-
# close as we can get). jenkins junit plugin will merge all
239-
# the files...
240-
junit_suffix = "-".join(targets)
241-
junitfile = f"junit-{junit_suffix}.xml"
242-
suite_name = f"pytest-{junit_suffix}"
243-
244-
move_junit_file("junit-tmp.xml", junitfile, suite_name)
226+
# produce individual junit files that are per-database (or as
227+
# close as we can get). jenkins junit plugin will merge all
228+
# the files...
229+
junit_suffix = "-".join(targets)
230+
junitfile = f"junit-{junit_suffix}.xml"
231+
cmd.extend(["--junitxml", junitfile])
232+
233+
session.run(*pifpaf_cmd, *cmd, *backend_cmd, *posargs)
245234

246235

247236
@nox.session(name="pep484")

tools/toxnox.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from __future__ import annotations
1212

1313
import collections
14-
import os
1514
import re
1615
import sys
1716
from typing import Any
@@ -216,13 +215,3 @@ def extract(arg: str):
216215
return [arg for arg in posargs if not extract(arg)], return_tuple(
217216
*return_args
218217
)
219-
220-
221-
def move_junit_file(tmpfilename: str, newname: str, suite_name: str):
222-
import junitparser
223-
224-
xml = junitparser.JUnitXml.fromfile(tmpfilename)
225-
for suite in xml:
226-
suite.name = suite_name
227-
xml.write(newname)
228-
os.unlink(tmpfilename)

0 commit comments

Comments
 (0)