Skip to content

Standardize project test structure - #75

Merged
xingyaoww merged 1 commit into
mainfrom
openhands/standardize-test-structure
Sep 3, 2025
Merged

xingyaoww merged 1 commit into
mainfrom
openhands/standardize-test-structure

Conversation

@xingyaoww

Copy link
Copy Markdown
Contributor

Summary

This PR reorganizes the test structure to follow Python community standards by moving tests from package-specific directories to a centralized structure under tests/.

Changes

Test Structure Reorganization

  • openhands/core/tests → tests/core (unit tests for core package)
  • openhands/tools/tests → tests/tools (unit tests for tools package)
  • tests → tests/integration (integration tests)

CI Configuration Updates

  • Updated .github/workflows/tests.yml to use new test paths
  • Changed from pytest to python -m pytest for better import handling
  • All test commands now point to the new directory structure

Benefits

  1. Follows Python Community Standards: As recommended by pytest documentation, tests are now outside the package directories
  2. Cleaner Project Structure: All tests are centralized under a single tests/ directory
  3. Easier Package Splitting: If packages need to be split in the future, the test structure won't be affected
  4. Better Organization: Clear separation between unit tests (tests/core, tests/tools) and integration tests (tests/integration)

Testing

  • ✅ All core tests pass (152 tests)
  • ✅ All tools tests pass (135+ tests)
  • ✅ All integration tests pass (4 tests)
  • ✅ Pre-commit hooks pass (ruff format, ruff lint, pyright type checking)

Verification

The reorganization maintains all existing functionality:

  • Tests use absolute imports (from openhands.core..., from openhands.tools...) so no import changes were needed
  • Git correctly detected file moves as renames, preserving history
  • CI workflows updated to use new paths with python -m pytest for reliable imports

Fixes #62

@xingyaoww can click here to continue refining the PR

Move tests from package-specific directories to centralized structure:
- openhands/core/tests → tests/core
- openhands/tools/tests → tests/tools
- tests → tests/integration

This follows Python community standards and makes the project structure cleaner.
Updated CI workflows to use new test paths and python -m pytest for better import handling.

Fixes #62

Co-authored-by: openhands <openhands@all-hands.dev>
@csmith49

csmith49 commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Note that this does tests/core instead of tests/unit/core suggested by the issue, but I like the former better.

@xingyaoww
xingyaoww merged commit 49e2f51 into main Sep 3, 2025
@xingyaoww
xingyaoww deleted the openhands/standardize-test-structure branch September 3, 2025 17:14
StressTestor pushed a commit to StressTestor/software-agent-sdk that referenced this pull request Jun 1, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
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.

Standardize project test structure

3 participants