diff --git a/web/services/github_issue_manager/github_issue_manager.py b/web/services/github_issue_manager/github_issue_manager.py index c1ec608..9142a96 100644 --- a/web/services/github_issue_manager/github_issue_manager.py +++ b/web/services/github_issue_manager/github_issue_manager.py @@ -8,8 +8,12 @@ from github import Github, Auth logger = logging.getLogger() -line_exp = re.compile(r"\s*File \".*(mantidqt|mantidqtinterfaces|" - r"workbench|scripts)(\/|\\)(.*)(\", line \d+, in \S+)") +line_exp = re.compile(r"\s*File \".*(mantid|mantidqt|mantidqtinterfaces|" + r"workbench|scripts|plugins)" + r"(\/|\\)(.*)(\", line \d+, in \S+)") +alt_line_exp = re.compile(r"\s*(at line \d+ in )\'.*(mantid|mantidqt|" + r"mantidqtinterfaces|workbench|scripts|plugins)" + r"(\/|\\)(.*)\'") ISSUE_TEXT = Template(""" Name: $name Email: $email @@ -124,6 +128,14 @@ def _stacktrace_line_trimer(line: str) -> str: os.path.normpath("".join(match.group(1, 2, 3))) ) return path.as_posix() + match.group(4) + + match = alt_line_exp.match(line) + if match: + path = pathlib.PureWindowsPath( + os.path.normpath("".join(match.groups(2, 3, 4))) + ) + return match.group(1) + path.as_posix() + return line diff --git a/web/services/github_issue_manager/test_trim_stacktrace.py b/web/services/github_issue_manager/test_trim_stacktrace.py index 33fe9f9..9add7a0 100644 --- a/web/services/github_issue_manager/test_trim_stacktrace.py +++ b/web/services/github_issue_manager/test_trim_stacktrace.py @@ -20,7 +20,11 @@ def test_line_trimmer_file_lines(self): r'File "D:\Mantid\Software\MantidInstall\bin\lib\site-packages\mantidqt\widgets\codeeditor\execution.py", line 153, in execute': r'mantidqt/widgets/codeeditor/execution.py", line 153, in execute', r'File "/opt/mantidworkbenchnightly/scripts/ExternalInterfaces/mslice/presenters/workspace_manager_presenter.py", line 112, in _save_to_ads': - r'scripts/ExternalInterfaces/mslice/presenters/workspace_manager_presenter.py", line 112, in _save_to_ads' + r'scripts/ExternalInterfaces/mslice/presenters/workspace_manager_presenter.py", line 112, in _save_to_ads', + r"at line 152 in '/usr/local/anaconda/envs/mantid-dev/plugins/python/algorithms/ConvertWANDSCDtoQ.py'": + r'at line 152 in plugins/python/algorithms/ConvertWANDSCDtoQ.py', + r'File "/opt/mantidworkbench6.9/lib/python3.10/site-packages/mantid/simpleapi.py", line 1083, in __call__': + r'mantid/simpleapi.py", line 1083, in __call__' } for original, expected_trim in examples.items(): self.assertEqual(_stacktrace_line_trimer(original), expected_trim)