Skip to content

Commit

Permalink
feature: support ignore tag
Browse files Browse the repository at this point in the history
If the test has the `ignore` tag, the reporter will not send the result to Qase.
  • Loading branch information
gibiw committed Sep 9, 2024
1 parent c026209 commit c743211
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
8 changes: 8 additions & 0 deletions qase-robotframework/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# qase-pytest 3.1.1

## What's new

Minor release that includes all changes from beta versions 3.1.1b.

Support `ignore` tag. If the test has the `ignore` tag, the reporter will not send the result to Qase.

# qase-pytest 3.1.1b2

## What's new
Expand Down
4 changes: 2 additions & 2 deletions qase-robotframework/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "qase-robotframework"
version = "3.1.1b2"
version = "3.1.1"
description = "Qase Robot Framework Plugin"
readme = "README.md"
authors = [{name = "Qase Team", email = "[email protected]"}]
Expand All @@ -17,7 +17,7 @@ classifiers = [
urls = {"Homepage" = "https://github.com/qase-tms/qase-python/tree/master/qase-robotframework"}
requires-python = ">=3.7"
dependencies = [
"qase-python-commons~=3.1.0",
"qase-python-commons~=3.1.3",
]

[project.optional-dependencies]
Expand Down
24 changes: 17 additions & 7 deletions qase-robotframework/src/qase/robotframework/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def start_test(self, name, attributes: StartTestModel):
def end_test(self, name, attributes: EndTestModel):
logger.debug("Finishing test '%s'", name)

self.step_uuid = None

if self.__is_test_ignore(attributes.get("tags")):
logger.info("Test '%s' is ignored", name)
return

case_id = self._extract_ids(attributes.get("tags"))
if case_id:
self.runtime.result.testops_id = int(case_id)
Expand Down Expand Up @@ -80,8 +86,6 @@ def end_test(self, name, attributes: EndTestModel):

self.reporter.add_result(self.runtime.result)

self.step_uuid = None

logger.info(
"Finished case result: %s, error: %s",
attributes.get("status"),
Expand Down Expand Up @@ -117,12 +121,18 @@ def close(self):
logger.info("complete run executing")
self.reporter.complete_run()

def log_message(self, message):
@staticmethod
def log_message(message):
logger.debug("Log:", message)

def _extract_ids(self, list_of_tags: List[str]):
id = re.compile(r"Q-(\d+)", re.IGNORECASE)
@staticmethod
def _extract_ids(list_of_tags: List[str]):
qase_id = re.compile(r"Q-(\d+)", re.IGNORECASE)
for tag in list_of_tags:
if id.fullmatch(tag):
return int(id.match(tag).groups()[0])
if qase_id.fullmatch(tag):
return int(qase_id.match(tag).groups()[0])
return None

@staticmethod
def __is_test_ignore(list_of_tags: List[str]):
return any(tag.lower() == "ignore" for tag in list_of_tags)

0 comments on commit c743211

Please sign in to comment.