Skip to content

Added docstring as test case text#75

Open
jcm-mx wants to merge 8 commits intokiwitcms:masterfrom
jcm-mx:feature/docstrings_as_text
Open

Added docstring as test case text#75
jcm-mx wants to merge 8 commits intokiwitcms:masterfrom
jcm-mx:feature/docstrings_as_text

Conversation

@jcm-mx
Copy link
Copy Markdown

@jcm-mx jcm-mx commented Apr 19, 2026

Making it so the text in the docstrings is what gets reported as text in kiwi tcms. This should allow for more descriptive test cases in kiwi

Copy link
Copy Markdown
Member

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, needs a few small changes.

Comment thread tests/test_docstring_reporting.py Outdated
@@ -0,0 +1,129 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 2026 as the year and also add your name/email as the author. Feel free to add yourself to __init__.py as well.

Comment thread tests/test_docstring_reporting.py Outdated
"""Docstring harvested for test A must not be sent when test B runs."""
item_a = _make_item("tests/test_foo.py::test_a", "Intention A")
item_b = _make_item("tests/test_foo.py::test_b", None)
item_b.function.__doc__ = None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: If _make_item() takes None as an argument, why do you need to set the docstring explicitly on line 114 ?


_simulate_logstart(plugin, "tests/test_foo.py::test_b")

plugin.backend.update_test_case_text.assert_not_called()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better assertion here would be that we've updated the text for test_a but not for test_b. Otherwise we may be missing a corner case.

Comment thread tcms_pytest_plugin/__init__.py Outdated

docstring = self._docstrings.get(nodeid)
if docstring:
self.backend.update_test_case_text(test_case["id"], docstring)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this immediately after line 70 - it makes more logical sense there.

Comment thread tcms_pytest_plugin/__init__.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants