Skip to content

AI-2841: print integtest project info before tests start#441

Open
vita-stejskal wants to merge 1 commit intomainfrom
AI-2841-print-integtest-project-info
Open

AI-2841: print integtest project info before tests start#441
vita-stejskal wants to merge 1 commit intomainfrom
AI-2841-print-integtest-project-info

Conversation

@vita-stejskal
Copy link
Copy Markdown
Contributor

@vita-stejskal vita-stejskal commented Mar 27, 2026

Description

Linear: AI-2841

Change Type

  • Major (breaking changes, significant new features)
  • Minor (new features, enhancements, backward compatible)
  • Patch (bug fixes, small improvements, no new features)

Summary

When running integration tests, the project/token summary (which project is
locked, which token is used) was invisible in compact pytest output because
it was written during session fixture setup — at which point pytest's ANSI
compact-mode progress display overwrites the line.

Fix: acquire the project lock eagerly in the pytest_collection_finish hook,
which fires after collection but before any test runs. At that point the
terminal is stable and write_sep / write_line produce permanently visible
output. The project_lock fixture falls back to lazy acquisition if the hook
didn't run (e.g. missing env vars), and pytest_terminal_summary covers that
fallback path so the info always appears somewhere.

Also extracted ProjectEndpoint.describe() so the human-readable summary
string is defined in one place, and pulled pool setup into _setup_pool()
so it can be shared between the hook and the fixture fallback.

Testing

  • Tested with Cursor AI desktop (Streamable-HTTP transports)

Checklist

  • Self-review completed
  • Unit tests added/updated (if applicable)
  • Integration tests added/updated (if applicable)
  • Project version bumped according to the change type (if applicable)
  • Documentation updated (if applicable)

Acquires the project lock eagerly in pytest_collection_finish (fires after
collection, before any test runs) so the project/token summary line appears
before test progress output, avoiding ANSI overwrite in compact mode.

- Extract _setup_pool() helper shared by hook and fixture fallback
- Add pytest_collection_finish hook that acquires, prints, and sets state
- Simplify project_lock fixture to reuse already-acquired lock when available
- Keep pytest_terminal_summary as fallback for cases where hook is skipped
- Add ProjectEndpoint.describe() so the summary string is defined once
- Add token_id and token_description fields to ProjectEndpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vita-stejskal vita-stejskal self-assigned this Mar 27, 2026
@linear
Copy link
Copy Markdown

linear bot commented Mar 27, 2026

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.

1 participant