Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertomonteromiguel committed Oct 14, 2024
1 parent 7e99d5e commit de67e2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion utils/_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ class CustomSpec(semver.NpmSpec):
_MANIFEST_ERROR_MESSAGE = "Please use manifest file, See docs/edit/manifest.md"


def is_jira_ticket(reason: str):
return reason is not None and _jira_ticket_pattern.fullmatch(reason)


def _ensure_jira_ticket_as_reason(item, reason: str):

if reason is None or not _jira_ticket_pattern.fullmatch(reason):
if not is_jira_ticket(reason):
path = inspect.getfile(item)
rel_path = os.path.relpath(path)

Expand Down
10 changes: 7 additions & 3 deletions utils/virtual_machine/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from utils import context
from utils._decorators import is_jira_ticket


def parametrize_virtual_machines(bugs: list[dict] = None):
Expand Down Expand Up @@ -28,9 +29,12 @@ def decorator(func):
and (not "vm_cpu" in bug or vm.os_cpu == bug["vm_cpu"])
and (not "weblog_variant" in bug or context.weblog_variant == bug["weblog_variant"])
):
parameters.append(pytest.param(vm, marks=pytest.mark.xfail(reason=f"bug: {bug['reason']}")))
bug_found = True
break
if "reason" in bug and is_jira_ticket(bug["reason"]):
parameters.append(pytest.param(vm, marks=pytest.mark.xfail(reason=f"bug: {bug['reason']}")))
bug_found = True
break
else:
raise ValueError(f"Invalid bug reason for {vm.name} {bug}. Please use a valid JIRA ticket.")

if bug_found == False:
parameters.append(vm)
Expand Down

0 comments on commit de67e2e

Please sign in to comment.