t-bug-catcher 0.2.1__tar.gz → 0.2.2__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.
Files changed (24) hide show
  1. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/PKG-INFO +1 -1
  2. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/setup.cfg +1 -1
  3. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/setup.py +1 -1
  4. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/__init__.py +1 -1
  5. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/jira.py +68 -37
  6. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/PKG-INFO +1 -1
  7. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/MANIFEST.in +0 -0
  8. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/README.rst +0 -0
  9. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/pyproject.toml +0 -0
  10. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/requirements.txt +0 -0
  11. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/bug_catcher.py +0 -0
  12. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/bug_snag.py +0 -0
  13. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/config.py +0 -0
  14. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/exceptions.py +0 -0
  15. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/utils/__init__.py +0 -0
  16. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/utils/common.py +0 -0
  17. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/utils/logger.py +0 -0
  18. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher/workitems.py +0 -0
  19. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
  20. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
  21. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/not-zip-safe +0 -0
  22. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/requires.txt +0 -0
  23. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/t_bug_catcher.egg-info/top_level.txt +0 -0
  24. {t_bug_catcher-0.2.1 → t_bug_catcher-0.2.2}/tests/test_t_bug_catcher.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.2.1
2
+ current_version = 0.2.2
3
3
  commit = True
4
4
  tag = False
5
5
 
@@ -26,7 +26,7 @@ setup(
26
26
  packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
27
27
  test_suite="tests",
28
28
  url="https://www.thoughtful.ai/",
29
- version="0.2.1",
29
+ version="0.2.2",
30
30
  zip_safe=False,
31
31
  install_requires=install_requirements,
32
32
  )
@@ -3,7 +3,7 @@
3
3
  __author__ = """Thoughtful"""
4
4
  __email__ = "support@thoughtful.ai"
5
5
  # fmt: off
6
- __version__ = '0.2.1'
6
+ __version__ = '0.2.2'
7
7
  # fmt: on
8
8
 
9
9
  from .bug_catcher import (
@@ -404,12 +404,8 @@ class Jira:
404
404
  "text": "Run link: ",
405
405
  "marks": [{"type": "strong"}],
406
406
  },
407
- {
408
- "type": "text",
409
- "text": CONFIG.ENVIRONMENT,
410
- "marks": ([] + self.__link_markup()),
411
- },
412
- ],
407
+ ]
408
+ + self.__link_markup(),
413
409
  }
414
410
  ]
415
411
  if CONFIG.ENVIRONMENT != "local"
@@ -529,19 +525,39 @@ class Jira:
529
525
  link_markup = {
530
526
  variables.get("environment"): [
531
527
  {
532
- "type": "link",
533
- "attrs": {"href": variables.get("processRunUrl")},
534
- },
535
- {"type": "underline"},
528
+ "type": "text",
529
+ "text": variables.get("processRunUrl"),
530
+ "marks": [
531
+ {
532
+ "type": "link",
533
+ "attrs": {"href": variables.get("processRunUrl")},
534
+ },
535
+ {"type": "underline"},
536
+ ],
537
+ }
536
538
  ],
537
539
  "robocloud": [
538
540
  {
539
- "type": "link",
540
- "attrs": {"href": CONFIG.RC_RUN_LINK},
541
- },
542
- {"type": "underline"},
541
+ "type": "text",
542
+ "text": "https://cloud.robocorp.com",
543
+ "marks": [
544
+ {
545
+ "type": "link",
546
+ "attrs": {"href": CONFIG.RC_RUN_LINK},
547
+ },
548
+ {"type": "underline"},
549
+ ],
550
+ }
551
+ ],
552
+ "local": [
553
+ {
554
+ "type": "text",
555
+ "text": "local run",
556
+ "marks": [
557
+ {"type": "underline"},
558
+ ],
559
+ }
543
560
  ],
544
- "local": [{"type": "underline"}],
545
561
  }
546
562
  return link_markup[CONFIG.ENVIRONMENT]
547
563
 
@@ -653,28 +669,33 @@ class Jira:
653
669
  if len(error) < CONFIG.LIMITS.MAX_DESCRIPTION_LENGTH
654
670
  else error[: CONFIG.LIMITS.MAX_DESCRIPTION_LENGTH] + "..."
655
671
  )
672
+ date_markup = [
673
+ {
674
+ "type": "text",
675
+ "text": f" at {str(datetime.datetime.now().strftime('%B %d, %Y %I:%M:%S %p'))}",
676
+ },
677
+ {"type": "hardBreak"},
678
+ ]
656
679
 
657
680
  error_markup = [
681
+ {
682
+ "type": "text",
683
+ "text": error,
684
+ "marks": [{"type": "code"}],
685
+ },
686
+ ]
687
+
688
+ comment_markup = [
658
689
  {
659
690
  "type": "paragraph",
660
- "content": [
661
- {"type": "text", "text": "Error occures again in "},
662
- {
663
- "type": "text",
664
- "text": CONFIG.ENVIRONMENT,
665
- "marks": ([] + self.__link_markup()),
666
- },
667
- {
668
- "type": "text",
669
- "text": f" at {str(datetime.datetime.now().strftime('%B %d, %Y %I:%M:%S %p'))}",
670
- },
671
- {"type": "hardBreak"},
672
- {
673
- "type": "text",
674
- "text": error,
675
- "marks": [{"type": "code"}],
676
- },
677
- ],
691
+ "content": (
692
+ [
693
+ {"type": "text", "text": "Error occures again in "},
694
+ ]
695
+ + self.__link_markup()
696
+ + date_markup
697
+ + error_markup
698
+ ),
678
699
  }
679
700
  ]
680
701
 
@@ -711,7 +732,7 @@ class Jira:
711
732
  "type": "doc",
712
733
  "version": 1,
713
734
  "content": []
714
- + (error_markup if error else [])
735
+ + (comment_markup if error else [])
715
736
  + (self.__description_markup(additional_info) if additional_info else [])
716
737
  + (attach_markup if attachments else [])
717
738
  + (self.__metadata_markup(metadata) if metadata else []),
@@ -780,7 +801,13 @@ class Jira:
780
801
  posted_attachments = []
781
802
  else:
782
803
  posted_attachments = (
783
- [self.add_attachment(attachment, issue["id"]) for attachment in attachments] if attachments else []
804
+ [
805
+ self.add_attachment(attachment, issue["id"])
806
+ for attachment in attachments
807
+ if os.path.exists(str(attachment))
808
+ ]
809
+ if attachments
810
+ else []
784
811
  )
785
812
 
786
813
  self.update_comment(
@@ -834,7 +861,8 @@ class Jira:
834
861
  ticket_id = ticket["id"]
835
862
  if attachments:
836
863
  for attachment in attachments:
837
- self.add_attachment(attachment, ticket_id)
864
+ if os.path.exists(str(attachment)):
865
+ self.add_attachment(attachment, ticket_id)
838
866
  if self._webhook_url:
839
867
  self.move_ticket_to_board(ticket_id)
840
868
  return response
@@ -843,7 +871,7 @@ class Jira:
843
871
  self,
844
872
  exception: Optional[Exception] = None,
845
873
  assignee: Optional[str] = None,
846
- attachments: Optional[List] = None,
874
+ attachments: Union[List, str, Path, None] = None,
847
875
  metadata: Optional[dict] = None,
848
876
  additional_info: Optional[str] = None,
849
877
  ) -> dict:
@@ -866,6 +894,9 @@ class Jira:
866
894
  if attachments is None:
867
895
  attachments = []
868
896
 
897
+ if isinstance(attachments, (str, Path)):
898
+ attachments = [str(attachments)]
899
+
869
900
  if not isinstance(attachments, List):
870
901
  logger.warning(f"Incorrect type of attachments: {type(attachments)}")
871
902
  attachments = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: t_bug_catcher
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
File without changes
File without changes