Skip to content

Commit 3c667b7

Browse files
gibiwjoerendleman
andcommitted
feat: expose get_qase_ids as public API on QasePytestPlugin
Renames QasePytestPlugin._get_qase_ids to get_qase_ids so third-party pytest plugins can read the Qase IDs associated with a pytest item without parsing the qase_id marker themselves. Internal call sites and tests are updated to use the new name. Version bumped to 8.3.0. Co-authored-by: joerendleman <joerendleman@ridealso.com>
1 parent 36025bd commit 3c667b7

4 files changed

Lines changed: 19 additions & 11 deletions

File tree

qase-pytest/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# qase-pytest 8.3.0
2+
3+
## What's new
4+
5+
- Exposed `QasePytestPlugin.get_qase_ids(item)` as a public static method
6+
so third-party pytest plugins can read the Qase IDs associated with a
7+
pytest item without parsing the `qase_id` marker themselves.
8+
19
# qase-pytest 8.2.0
210

311
## What's new

qase-pytest/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "qase-pytest"
7-
version = "8.2.0"
7+
version = "8.3.0"
88
description = "Qase Pytest Plugin for Qase TestOps and Qase Report"
99
readme = "README.md"
1010
keywords = ["qase", "pytest", "plugin", "testops", "report", "qase reporting", "test observability"]

qase-pytest/src/qase/pytest/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def pytest_collection_modifyitems(self, session, config, items):
101101
new_items = []
102102
for item in items:
103103
if item.get_closest_marker('qase_id'):
104-
ids = QasePytestPlugin._get_qase_ids(item)
104+
ids = QasePytestPlugin.get_qase_ids(item)
105105
if any(id in self.execution_plan for id in ids):
106106
new_items.append(item)
107107

@@ -430,7 +430,7 @@ def _set_testops_ids(self, item) -> None:
430430
self.runtime.result.set_testops_project_mapping(project_code, testops_ids)
431431
else:
432432
# Single project mode: use old testops_ids
433-
self.runtime.result.testops_ids = QasePytestPlugin._get_qase_ids(item)
433+
self.runtime.result.testops_ids = QasePytestPlugin.get_qase_ids(item)
434434
except (AttributeError, TypeError, ValueError):
435435
pass
436436

@@ -542,7 +542,7 @@ def __is_xfail_mark(report):
542542
return hasattr(report, 'wasxfail')
543543

544544
@staticmethod
545-
def _get_qase_ids(item) -> Union[None, List[int]]:
545+
def get_qase_ids(item) -> Union[None, List[int]]:
546546
marker = item.get_closest_marker("qase_id")
547547
if marker is None:
548548
return None

qase-pytest/tests/tests_qase_pytest/test_plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,37 +59,37 @@ def make_plugin():
5959

6060

6161
class TestGetQaseIds:
62-
"""Test _get_qase_ids static method edge cases."""
62+
"""Test get_qase_ids static method edge cases."""
6363

6464
def test_returns_none_when_no_marker(self):
6565
item = make_mock_item()
66-
assert QasePytestPlugin._get_qase_ids(item) is None
66+
assert QasePytestPlugin.get_qase_ids(item) is None
6767

6868
def test_returns_list_with_integer_id(self):
6969
marker = make_marker(id=42)
7070
item = make_mock_item(markers={"qase_id": marker})
71-
assert QasePytestPlugin._get_qase_ids(item) == [42]
71+
assert QasePytestPlugin.get_qase_ids(item) == [42]
7272

7373
def test_returns_list_from_comma_separated_string(self):
7474
marker = make_marker(id="1,2,3")
7575
item = make_mock_item(markers={"qase_id": marker})
76-
assert QasePytestPlugin._get_qase_ids(item) == [1, 2, 3]
76+
assert QasePytestPlugin.get_qase_ids(item) == [1, 2, 3]
7777

7878
def test_returns_none_when_id_kwarg_is_none(self):
7979
marker = make_marker(id=None)
8080
item = make_mock_item(markers={"qase_id": marker})
81-
assert QasePytestPlugin._get_qase_ids(item) is None
81+
assert QasePytestPlugin.get_qase_ids(item) is None
8282

8383
def test_handles_string_with_spaces(self):
8484
marker = make_marker(id="10, 20, 30")
8585
item = make_mock_item(markers={"qase_id": marker})
86-
assert QasePytestPlugin._get_qase_ids(item) == [10, 20, 30]
86+
assert QasePytestPlugin.get_qase_ids(item) == [10, 20, 30]
8787

8888
def test_raises_on_non_numeric_string(self):
8989
marker = make_marker(id="abc")
9090
item = make_mock_item(markers={"qase_id": marker})
9191
with pytest.raises(ValueError):
92-
QasePytestPlugin._get_qase_ids(item)
92+
QasePytestPlugin.get_qase_ids(item)
9393

9494

9595
class TestGetTitle:

0 commit comments

Comments
 (0)