@@ -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