t-bug-catcher 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/PKG-INFO +1 -1
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/setup.cfg +1 -1
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/setup.py +1 -1
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/config.py +2 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/jira.py +74 -9
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/PKG-INFO +1 -1
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/MANIFEST.in +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/README.rst +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/pyproject.toml +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/requirements.txt +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/bug_catcher.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/utils/common.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/utils/logger.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher/workitems.py +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/requires.txt +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.3.0 → t_bug_catcher-0.3.1}/tests/test_t_bug_catcher.py +0 -0
|
@@ -12,6 +12,7 @@ class Config:
|
|
|
12
12
|
MAX_ATTACHMENTS: int = 5
|
|
13
13
|
MAX_ISSUE_ATTACHMENTS: int = 100
|
|
14
14
|
MAX_DESCRIPTION_LENGTH: int = 250
|
|
15
|
+
SUMMARY_LENGTH: int = 120
|
|
15
16
|
|
|
16
17
|
SUPPORT_BOARD = "AB"
|
|
17
18
|
|
|
@@ -29,6 +30,7 @@ class Config:
|
|
|
29
30
|
|
|
30
31
|
STAGE = metadata.get("process", dict()).get("implementationStage", "")
|
|
31
32
|
ADMIN_CODE = metadata.get("process", dict()).get("adminCode", "")
|
|
33
|
+
WORKER_NAME = metadata.get("process", dict()).get("name", "")
|
|
32
34
|
EMPOWER_URL = metadata.get("process", dict()).get("processRunUrl") or variables.get("processRunUrl")
|
|
33
35
|
|
|
34
36
|
|
|
@@ -7,6 +7,7 @@ import os
|
|
|
7
7
|
import re
|
|
8
8
|
import sys
|
|
9
9
|
import traceback
|
|
10
|
+
from importlib.metadata import version
|
|
10
11
|
from pathlib import Path
|
|
11
12
|
from types import TracebackType
|
|
12
13
|
from typing import List, Optional, Union
|
|
@@ -442,6 +443,34 @@ class Jira:
|
|
|
442
443
|
}
|
|
443
444
|
]
|
|
444
445
|
|
|
446
|
+
@staticmethod
|
|
447
|
+
def __bot_name_markup() -> List[dict]:
|
|
448
|
+
"""Create the ai worker markup.
|
|
449
|
+
|
|
450
|
+
Returns:
|
|
451
|
+
dict: The ai worker markup.
|
|
452
|
+
"""
|
|
453
|
+
return (
|
|
454
|
+
[
|
|
455
|
+
{
|
|
456
|
+
"type": "paragraph",
|
|
457
|
+
"content": [
|
|
458
|
+
{
|
|
459
|
+
"type": "text",
|
|
460
|
+
"text": "Process name: ",
|
|
461
|
+
"marks": [{"type": "strong"}],
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"type": "text",
|
|
465
|
+
"text": f"{CONFIG.ADMIN_CODE} - {CONFIG.WORKER_NAME}",
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
if CONFIG.ADMIN_CODE and CONFIG.WORKER_NAME
|
|
471
|
+
else []
|
|
472
|
+
)
|
|
473
|
+
|
|
445
474
|
@staticmethod
|
|
446
475
|
def __traceback_markup(exc_traceback_info: str) -> List[dict]:
|
|
447
476
|
"""Create the traceback markup.
|
|
@@ -522,6 +551,14 @@ class Jira:
|
|
|
522
551
|
{"type": "subsup", "attrs": {"type": "sub"}},
|
|
523
552
|
],
|
|
524
553
|
},
|
|
554
|
+
{
|
|
555
|
+
"type": "text",
|
|
556
|
+
"text": f" (v{version('t_bug_catcher')})",
|
|
557
|
+
"marks": [
|
|
558
|
+
{"type": "em"},
|
|
559
|
+
{"type": "subsup", "attrs": {"type": "sub"}},
|
|
560
|
+
],
|
|
561
|
+
},
|
|
525
562
|
],
|
|
526
563
|
},
|
|
527
564
|
]
|
|
@@ -540,7 +577,26 @@ class Jira:
|
|
|
540
577
|
},
|
|
541
578
|
{"type": "underline"},
|
|
542
579
|
],
|
|
543
|
-
}
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"type": "text",
|
|
583
|
+
"text": " [Robocloud ",
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"type": "text",
|
|
587
|
+
"text": "link",
|
|
588
|
+
"marks": [
|
|
589
|
+
{
|
|
590
|
+
"type": "link",
|
|
591
|
+
"attrs": {"href": CONFIG.RC_RUN_LINK},
|
|
592
|
+
},
|
|
593
|
+
{"type": "underline"},
|
|
594
|
+
],
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"type": "text",
|
|
598
|
+
"text": "]",
|
|
599
|
+
},
|
|
544
600
|
],
|
|
545
601
|
"robocloud": [
|
|
546
602
|
{
|
|
@@ -601,6 +657,7 @@ class Jira:
|
|
|
601
657
|
"type": "doc",
|
|
602
658
|
"content": []
|
|
603
659
|
+ (self.__error_string_markup(error_string, exc_info) if error_string else [])
|
|
660
|
+
+ self.__bot_name_markup()
|
|
604
661
|
+ self.__date_markup()
|
|
605
662
|
+ self.__runlink_markup()
|
|
606
663
|
+ self.__environment_markup()
|
|
@@ -1204,7 +1261,7 @@ class Jira:
|
|
|
1204
1261
|
return response[0]["accountId"]
|
|
1205
1262
|
|
|
1206
1263
|
@staticmethod
|
|
1207
|
-
def
|
|
1264
|
+
def sanitize_summary(exception: Union[Exception, str]) -> str:
|
|
1208
1265
|
"""Remove locators from the exception.
|
|
1209
1266
|
|
|
1210
1267
|
Args:
|
|
@@ -1213,9 +1270,11 @@ class Jira:
|
|
|
1213
1270
|
Returns:
|
|
1214
1271
|
str: The cleaned exception string.
|
|
1215
1272
|
"""
|
|
1273
|
+
message = re.sub("<([a-z]+)(?![^>]*\/>)[^>]*>", r"<\1>", str(exception))
|
|
1274
|
+
message = re.sub(">([^<]+)<\/", ">...</", message)
|
|
1216
1275
|
if "selenium" not in exception.__class__.__name__.lower() and not isinstance(exception, AssertionError):
|
|
1217
|
-
return str(
|
|
1218
|
-
return re.sub(r"\'(.+)\'", "'...'",
|
|
1276
|
+
return str(message)
|
|
1277
|
+
return re.sub(r"\'(.+)\'", "'...'", message)
|
|
1219
1278
|
|
|
1220
1279
|
def __create_summary(self, exc_type: type, exc_value: Union[Exception, str], exc_traceback: TracebackType) -> str:
|
|
1221
1280
|
"""Create the summary of the ticket.
|
|
@@ -1230,10 +1289,16 @@ class Jira:
|
|
|
1230
1289
|
"""
|
|
1231
1290
|
frames = get_frames(exc_traceback)
|
|
1232
1291
|
file_name, line_no, _, _ = frames[-1]
|
|
1233
|
-
summary = (
|
|
1234
|
-
f"[{exc_type.__name__}:{os.path.basename(file_name)}:{line_no}] "
|
|
1235
|
-
f"{self.remove_locators_from_exception(exc_value)}"
|
|
1236
|
-
)
|
|
1292
|
+
summary = f"[{exc_type.__name__}:{os.path.basename(file_name)}:{line_no}]"
|
|
1237
1293
|
if self._project_key == CONFIG.SUPPORT_BOARD and CONFIG.ADMIN_CODE:
|
|
1238
1294
|
summary = CONFIG.ADMIN_CODE + " - " + summary
|
|
1239
|
-
|
|
1295
|
+
if CONFIG.LIMITS.SUMMARY_LENGTH <= len(summary):
|
|
1296
|
+
return summary
|
|
1297
|
+
else:
|
|
1298
|
+
message = self.sanitize_summary(exc_value)
|
|
1299
|
+
message = (
|
|
1300
|
+
message
|
|
1301
|
+
if len(message) <= CONFIG.LIMITS.SUMMARY_LENGTH - len(summary)
|
|
1302
|
+
else message[: CONFIG.LIMITS.SUMMARY_LENGTH - len(summary)] + "..."
|
|
1303
|
+
)
|
|
1304
|
+
return summary + " " + message
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|