Muted CollectError of importerror from raising

This commit is contained in:
BigYajuu 2022-09-14 12:56:09 +08:00
parent 33a083e844
commit 4f9afe2a8d
1 changed files with 6 additions and 6 deletions

View File

@ -639,12 +639,12 @@ class Module(nodes.File, PyCollector):
else exc_info.exconly() else exc_info.exconly()
) )
formatted_tb = str(exc_repr) formatted_tb = str(exc_repr)
raise self.CollectError( # raise self.CollectError(
"ImportError while importing test module '{path}'.\n" # "ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n" # "Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n" # "Traceback:\n"
"{traceback}".format(path=self.path, traceback=formatted_tb) # "{traceback}".format(path=self.path, traceback=formatted_tb)
) from e # ) from e
except skip.Exception as e: except skip.Exception as e:
if e.allow_module_level: if e.allow_module_level:
raise raise