From 1beb9b5e764c91d9e84884b846bb978d9f9ecbf9 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Mon, 26 Aug 2024 09:44:25 +0200 Subject: [PATCH] release: qase-pytest 6.1.0 Minor release that includes all changes from beta versions 6.1.0b. And also added support for group parameters. --- qase-pytest/changelog.md | 7 +++++++ qase-pytest/pyproject.toml | 4 ++-- qase-pytest/src/qase/pytest/plugin.py | 20 +++++++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/qase-pytest/changelog.md b/qase-pytest/changelog.md index 38ea66d9..05d9d79d 100644 --- a/qase-pytest/changelog.md +++ b/qase-pytest/changelog.md @@ -1,3 +1,10 @@ +# qase-pytest 6.1.0 + +## What's new + +Minor release that includes all changes from beta versions 6.1.0b. +And also added support for group parameters. + # qase-pytest 6.1.0b4 ## What's new diff --git a/qase-pytest/pyproject.toml b/qase-pytest/pyproject.toml index 9a58f9e9..1d70b981 100644 --- a/qase-pytest/pyproject.toml +++ b/qase-pytest/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-pytest" -version = "6.1.0b4" +version = "6.1.0" description = "Qase Pytest Plugin for Qase TestOps and Qase Report" readme = "README.md" keywords = ["qase", "pytest", "plugin", "testops", "report", "qase reporting", "test observability"] @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - "qase-python-commons~=3.1.0b6", + "qase-python-commons~=3.1.0", "pytest>=7.4.4", "filelock~=3.12.2", "more_itertools", diff --git a/qase-pytest/src/qase/pytest/plugin.py b/qase-pytest/src/qase/pytest/plugin.py index e3b038cf..284e71ca 100644 --- a/qase-pytest/src/qase/pytest/plugin.py +++ b/qase-pytest/src/qase/pytest/plugin.py @@ -1,7 +1,6 @@ import pathlib from typing import Tuple, Union import mimetypes -import re from qase.commons.models.result import Result, Field from qase.commons.models.attachment import Attachment @@ -68,6 +67,22 @@ def drop_run_id(): QasePytestPlugin.meta_run_file.unlink() def pytest_collection_modifyitems(self, session, config, items): + """ + Modify collected test items to inject our parameter capturing logic. + """ + for item in items: + grouped_params = [] + + # Extract single and grouped params from the item's markers + for mark in item.iter_markers(): + if mark.name == 'parametrize': + param_name, values = mark.args + if ',' in param_name: + grouped_params.append(param_name.split(',')) + + # Attach the captured params to the test item + item._grouped_params = grouped_params + # Filter test cases based on ids if self.execution_plan: items[:] = [item for item in items if @@ -267,6 +282,9 @@ def _set_testops_id(self, item) -> None: def _set_params(self, item) -> None: if hasattr(item, 'callspec'): + for group in item._grouped_params: + self.runtime.result.add_param_groups(group) + for key, val in item.callspec.params.items(): if key.startswith("__pytest"): continue