Skip to content

feat: add unit tests and contribution guide#183

Open
Shreyansh1729 wants to merge 2 commits intoVectifyAI:mainfrom
Shreyansh1729:feat/docker-compose-and-tests
Open

feat: add unit tests and contribution guide#183
Shreyansh1729 wants to merge 2 commits intoVectifyAI:mainfrom
Shreyansh1729:feat/docker-compose-and-tests

Conversation

@Shreyansh1729
Copy link
Copy Markdown

@Shreyansh1729 Shreyansh1729 commented Mar 26, 2026

Summary

This PR adds a comprehensive unit test suite and contribution guidelines to improve the project's code quality and developer experience.

Changes Made

  • tests/test_utils.py: 48 pytest tests covering all pure utility functions in pageindex/utils.py (JSON extraction, tree manipulation, node ID assignment, filename sanitization, structure formatting)
  • tests/test_retrieve.py: 16 pytest tests covering page parsing, document retrieval, structure retrieval, and error handling in pageindex/retrieve.py
  • CONTRIBUTING.md: Development setup instructions, test running guide, PR submission process, and code style expectations

Root Cause

The project had zero automated tests and no contribution guidelines, which are barriers for maintaining code quality and onboarding new contributors.

Testing

All 64 tests pass:

pytest tests/ -v
======================== 64 passed, 6 warnings in 4.43s ========================

All tests exercise pure functions only — no LLM API calls or network access required.

Usage

pip install pytest
pytest tests/ -v

- Add Dockerfile and docker-compose.yml for containerized usage (closes VectifyAI#137)
- Add .dockerignore to keep build context lean
- Add pytest-based unit tests for utils.py (48 tests) and retrieve.py (16 tests)
- Add CONTRIBUTING.md with development setup and PR guidelines
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@KylinMountain
Copy link
Copy Markdown
Collaborator

@Shreyansh1729 No idea why we need docker? It will be a pip library instead of a service.

@Shreyansh1729
Copy link
Copy Markdown
Author

Thanks for the feedback @KylinMountain That makes sense — PageIndex is a library, not a service, so Docker isn't the right fit here.

I'll remove the Docker files (Dockerfile, docker-compose.yml, .dockerignore) from this PR. The remaining changes — unit tests (64 tests for utils.py and retrieve.py) and CONTRIBUTING.md — are still useful independently. Would you like me to keep those in this PR, or split them into separate PRs?

PageIndex is a library, not a service — Docker containerization
is not the right fit. Keeping unit tests and CONTRIBUTING.md.
@Shreyansh1729 Shreyansh1729 changed the title feat: add Docker support, unit tests, and contribution guide feat: add unit tests and contribution guide 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.

2 participants