Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qase-pytest/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# qase-pytest 6.3.7

## What's new

Fixed an issue where the plugin would crash with `TypeError: 'ExceptionChainRepr' object is not subscriptable` when handling skip messages in newer versions of pytest. The plugin now properly handles both tuple/list format longrepr (old pytest versions) and ExceptionChainRepr format (new pytest versions) for skip message extraction.

# qase-pytest 6.3.6

## What's new
Expand Down
2 changes: 1 addition & 1 deletion 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.3.6"
version = "6.3.7"
description = "Qase Pytest Plugin for Qase TestOps and Qase Report"
readme = "README.md"
keywords = ["qase", "pytest", "plugin", "testops", "report", "qase reporting", "test observability"]
Expand Down
28 changes: 24 additions & 4 deletions qase-pytest/src/qase/pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ def pytest_runtest_makereport(self, item, call):
self.runtime.result.add_message(report.wasxfail)

# Handle skip message in setup phase
if (call.when == "setup" and
report.longrepr and
self.runtime.result.execution.status == PYTEST_TO_QASE_STATUS['SKIPPED']):
self.runtime.result.add_message(report.longrepr[2].split(":")[1])
self._handle_skip_message_in_setup(report, call)

# Handle Playwright artifacts if applicable
if call.when == "call":
Expand Down Expand Up @@ -232,6 +229,29 @@ def _set_result_status(self, status):
"""Set test result execution status."""
self.runtime.result.execution.status = status

def _handle_skip_message_in_setup(self, report, call):
"""Handle skip message in setup phase with proper longrepr handling."""
if (call.when == "setup" and
report.longrepr and
self.runtime.result.execution.status == PYTEST_TO_QASE_STATUS['SKIPPED']):
# Handle different types of longrepr
skip_message = None
if hasattr(report.longrepr, '__getitem__'):
# Handle tuple/list format (old pytest versions)
try:
skip_message = report.longrepr[2].split(":")[1]
except (IndexError, AttributeError):
pass
elif hasattr(report.longrepr, 'reprcrash'):
# Handle ExceptionChainRepr format (new pytest versions)
try:
skip_message = str(report.longrepr.reprcrash.message)
except AttributeError:
pass

if skip_message:
self.runtime.result.add_message(skip_message)

def _attach_logs(self, report):
"""Attach logs to the test result."""
logs = [
Expand Down