Skip to content

Update tcms-api to >=17.3 and support TestCase decorator - #95

Merged
atodorov merged 2 commits into
masterfrom
support-testcase-decorator
Dec 4, 2026
Merged

atodorov merged 2 commits into
masterfrom
support-testcase-decorator

Conversation

@kiwitcms-bot

Copy link
Copy Markdown
Member

tcms-api v17.3 adds a TestCase decorator in plugin_helpers.py which attaches TestCase model fields to a test function. Backend.test_case_get_or_create() can now accept the decorated callable as test_case_data.

This updates the pytest plugin to:

  • require tcms-api>=17.3
  • remember item.function during collection and pass it to test_case_get_or_create()
  • avoid overwriting an explicit @TestCase(text=...) with the test function docstring
  • document the decorator and cover the new behavior with unit tests

Existing summary-only behavior is unchanged when no decorator is used.

Local checks: pytest -p tcms_pytest_plugin tests/test_docstring_reporting.py (9 passed), black --check, flake8, and pylint.

@atodorov
atodorov marked this pull request as draft December 3, 2026 15:58
@kiwitcms-bot
kiwitcms-bot force-pushed the support-testcase-decorator branch 4 times, most recently from 41551da to 121c84f Compare December 4, 2026 11:21
Pass collected test functions to Backend.test_case_get_or_create() so
fields from @testcase are honored. Do not overwrite an explicit
TestCase.text supplied by the decorator with the function docstring.
Only fill TestCase.text from the test function docstring when the
existing value is empty. This avoids replacing manually written bodies.

Fixes #84
@kiwitcms-bot
kiwitcms-bot force-pushed the support-testcase-decorator branch from 121c84f to a440233 Compare December 4, 2026 11:29
@atodorov
atodorov marked this pull request as ready for review December 4, 2026 11:40
@atodorov
atodorov merged commit acb66c0 into master Dec 4, 2026
103 checks passed
@atodorov
atodorov deleted the support-testcase-decorator branch December 4, 2026 11:40
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.

2 participants