Skip to content

Fix pytest discovery for tests directory#525

Open
hhhxxw wants to merge 1 commit into
AsyncFuncAI:mainfrom
hhhxxw:v1.0.020260518
Open

Fix pytest discovery for tests directory#525
hhhxxw wants to merge 1 commit into
AsyncFuncAI:mainfrom
hhhxxw:v1.0.020260518

Conversation

@hhhxxw
Copy link
Copy Markdown

@hhhxxw hhhxxw commented May 18, 2026

Summary

  • Update pytest.ini so pytest discovers both tests/ and the legacy test/ directory.
  • Refresh tests/README.md to match the current test layout and commands.
  • Remove references to missing test files and document the existing test files.

Verification

  • Ran pytest collection from the repository root with the Poetry environment.
  • Confirmed 28 tests are collected from both tests/ and test/.
  • Ran git diff --check.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the test configuration and documentation to integrate a legacy test/ directory alongside the main tests/ suite. Key changes include modifying pytest.ini for broader test discovery and extensively updating tests/README.md with modern execution commands and Poetry-based dependency instructions. Feedback focused on correcting relative paths in documentation examples, avoiding hardcoded tool versions, and maintaining consistency by using Poetry for server execution.

Comment thread tests/README.md
If you are using the Poetry environment from `api/pyproject.toml` without activating it, run pytest from the repository root with explicit paths:

```bash
poetry -C api run python -m pytest ../tests ../test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When running from the repository root, the paths to the test directories should be tests and test relative to the current directory. Using ../ would incorrectly point to directories outside the project root.

Suggested change
poetry -C api run python -m pytest ../tests ../test
poetry -C api run python -m pytest tests test

Comment thread tests/README.md
Install the Python dependencies from the project root:

```bash
python -m pip install poetry==2.0.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding a specific version of Poetry (2.0.1) is restrictive. It is generally better to recommend installing the latest version or a version range (e.g., poetry>=2.0.0) to ensure compatibility with the project's configuration while allowing for updates.

Suggested change
python -m pip install poetry==2.0.1
python -m pip install poetry

Comment thread tests/README.md
cd api
python main.py
``` No newline at end of file
python -m api.main
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the rest of the documentation and to ensure the correct virtual environment is used, this command should be run via Poetry.

Suggested change
python -m api.main
poetry -C api run python -m api.main

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