Skip to content

Commit

Permalink
release: qase-pytest 6.1.0
Browse files Browse the repository at this point in the history
Minor release that includes all changes from beta versions 6.1.0b.
And also added support for group parameters.
  • Loading branch information
gibiw committed Aug 26, 2024
1 parent 5fd48f8 commit 1beb9b5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
7 changes: 7 additions & 0 deletions qase-pytest/changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions qase-pytest/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-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"]
Expand All @@ -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",
Expand Down
20 changes: 19 additions & 1 deletion qase-pytest/src/qase/pytest/plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1beb9b5

Please sign in to comment.