Skip to content

fix(tests): make test_jira.py collectable, add xdist/rerunfailures deps, add shared fixture - #1241

Merged
kovtcharov-amd merged 2 commits into
mainfrom
fix/877-pytest-infra
May 29, 2026
Merged

kovtcharov-amd merged 2 commits into
mainfrom
fix/877-pytest-infra

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

pytest --collect-only tests/test_jira.py was reporting 0 items because the file is a standalone argparse smoke-test script (real Jira API calls, own CLI flags, bool-returning methods) — not a pytest suite. Meanwhile, pytest-xdist and pytest-rerunfailures were missing from dev deps, and every test file that needed a LemonadeClient mock was duplicating the same patch target.

Closes #877 Parts B, C, D (Part A shipped in #1190).

Test plan

  • pytest --collect-only tests/test_jira.py → "file or directory not found" (no longer in tests/)
  • python scripts/jira_smoke.py --help still works (file moved, not deleted)
  • grep -E "pytest-xdist|pytest-rerunfailures" setup.py shows both deps
  • grep mock_lemonade_client tests/conftest.py shows the shared fixture
  • pytest --collect-only tests/conftest.py parses without errors

…ps, add shared fixture

Addresses issue #877 Parts B, C, D:

B: Moved tests/test_jira.py to scripts/jira_smoke.py — it's a standalone
   argparse CLI that makes real Jira API calls, not a pytest suite. pytest
   --collect-only was finding it and reporting 0 items collected.

C: Added pytest-xdist and pytest-rerunfailures to setup.py [dev] extras.
   CI commands not yet updated to use -n auto / --reruns (separate follow-up).

D: Added shared mock_lemonade_client fixture to tests/conftest.py near the
   existing lemonade_available/require_lemonade fixtures.
@github-actions github-actions Bot added documentation Documentation changes dependencies Dependency updates tests Test changes labels May 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Clean, well-scoped fix that unblocks CI collection without any functional risk. Two minor nits worth fixing before merge.

Summary

Moving test_jira.py out of tests/ is the right call — pytest was correctly reporting 0 items since the file uses its own argparse CLI rather than pytest conventions. All cross-file references (agent spec, docs, jira.mdx) are updated consistently, and the shared mock_lemonade_client fixture in conftest.py formalizes a pattern that was already documented in CLAUDE.md. No architectural or security concerns.

Issues Found

🟢 Stale path in print statement (scripts/jira_smoke.py:2989)

The rename missed one internal reference. The --list-tests output still prints the old invocation path:

print(f"  python tests/test_jira.py --test {method}")

This will confuse anyone who copies the suggested command — the file no longer exists at that path.

                print(f"  python scripts/jira_smoke.py --test {method}")

🟢 Docstring example uses a non-existent test name (scripts/jira_smoke.py:15)

The module docstring shows --test test_basic_fetch, but --test does an exact getattr lookup (line 3183). The actual method name is test_basic_fetch_queries; test_basic_fetch will hit the "not found" branch and exit silently. Use the full name to avoid a copy-paste trap:

    python scripts/jira_smoke.py --test test_basic_fetch_queries  # one test

Strengths

  • Why-first docstring. The new module docstring leads with the reason the file was moved (pytest --collect-only was picking it up with 0 items), which is exactly the right thing to preserve for future maintainers.
  • Consistent cross-file updates. The jira-specialist agent spec and the user-facing docs/guides/jira.mdx are both updated atomically — no stale references left in docs or agent routing.
  • Shared fixture formalises an existing convention. mock_lemonade_client in conftest.py matches the example that was already in CLAUDE.md's Testing Requirements section, making it a single authoritative patch target going forward.

Verdict

Approve with suggestions — both nits are one-liners; apply them before merge but no re-review needed.

The --list-tests rerun hint still pointed at the old tests/test_jira.py
location, and the docstring example used a truncated method name.
@github-actions

Copy link
Copy Markdown
Contributor

Summary

Clean, well-motivated housekeeping PR. Moving tests/test_jira.py to scripts/jira_smoke.py is the right call — the file never was a pytest suite (argparse CLI, real API calls, bool-returning methods), and leaving it in tests/ caused a confusing 0 items collection result. Every reference site is updated consistently: the user guide, the Jira specialist agent spec, and the internal print statement. The additions (pytest-xdist, pytest-rerunfailures, and the shared mock_lemonade_client fixture) are all well-placed and minimal.

No blocking issues found.


Issues Found

🟢 Minor — Stale path reference in docs/spec/jira-agent.mdx

The spec file has a comment-style placeholder at line 295 that still references the old location:

# tests/agents/test_jira_agent.py

This is a code-comment reference inside a spec doc, not the live path, so it's a nit rather than a broken pointer — but it's inconsistent now that the real smoke-test lives at scripts/jira_smoke.py. Worth a one-line touch while this PR is open.


Strengths

  • All reference sites updated atomically. Docs, agent spec, and the file's own internal print statement all land in the same PR, so nothing is left pointing at the old path.
  • mock_lemonade_client fixture is exactly the pattern prescribed in CLAUDE.md. Adding it to conftest.py (rather than duplicating mocker.patch("gaia.llm.lemonade_client.LemonadeClient") per-file) follows the project's shared-fixture convention and is immediately usable by downstream unit tests.
  • Docstring cleanup in scripts/jira_smoke.py is appropriately concise — the new header explains why the file was moved (pytest collection, issue Pytest infrastructure: fix silent skips, add xdist + reruns, conftest hygiene #877 Part B), not just what it does, which is the CLAUDE.md-endorsed "why over what" style.

Verdict

Approve. The stale docs/spec/jira-agent.mdx comment is a nit and not a blocker. Everything else is correct, complete, and scope-clean.

@kovtcharov-amd kovtcharov-amd added devops DevOps/infrastructure changes p0 high priority labels May 29, 2026
@kovtcharov-amd kovtcharov-amd self-assigned this May 29, 2026

@itomek itomek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified: both code nits from the earlier review are already fixed in head — grepped the PR-head scripts/jira_smoke.py and found zero remaining tests/test_jira references, and the docstring example uses the real method name test_basic_fetch_queries. The jira-agent.mdx:295 flag is a false positive — that's an illustrative "where unit tests would live" path in the spec, not a pointer to the moved smoke test. New deps (pytest-xdist, pytest-rerunfailures) are declared in setup.py. Approving.


Generated by Claude Code

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit b068f01 May 29, 2026
46 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/877-pytest-infra branch May 29, 2026 16:24
@kovtcharov-amd kovtcharov-amd mentioned this pull request Jun 1, 2026
5 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates devops DevOps/infrastructure changes documentation Documentation changes p0 high priority tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pytest infrastructure: fix silent skips, add xdist + reruns, conftest hygiene

2 participants