Skip to content

Commit e8cd57c

Browse files
committed
move cleanup to finally
Change-Id: Ia14991d1532c3d2b00b5f5b80567783f3de98b7c
1 parent 2c1c245 commit e8cd57c

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

noxfile.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,21 @@ def _tests(
227227
if opts.generate_junit:
228228
cmd.extend(["--junitxml", "junit-tmp.xml"])
229229

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

243246

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

0 commit comments

Comments
 (0)