PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

Feat: Add a pytest test suite for sync-microservice and run it in CI

Open Omega-127 opened this issue 4 weeks ago • 4 comments

Describe the feature

Feat: Add a pytest test suite for sync-microservice and run it in CI

Describe the feature backend/ has about 60 test files and a CI "Run Tests" step, but sync-microservice/ has no tests at all, and the PR check workflow only runs cd backend && pytest. Regressions in the folder watcher or its routes can therefore merge unnoticed.

Proposal

  1. Add pytest (and httpx for FastAPI's TestClient, already pinned) to sync-microservice/requirements.txt.
  2. Add sync-microservice/pytest.ini and a tests/ folder, mirroring backend/pytest.ini (pythonpath = ., testpaths = tests).
  3. Add a "Run Tests (Sync Microservice)" step to .github/workflows/pr-check.yml.
  4. Write the first tests for the smallest modules:
    • app/routes/health.py
    • app/routes/shutdown.py (mock the delayed shutdown so the test process isn't killed)
    • app/utils/watcher_helpers.py Follow-up PRs can cover routes/folders.py, routes/watcher.py and utils/watcher.py.

Acceptance criteria

  • cd sync-microservice && pytest passes locally and in CI.
  • At least the three modules above have tests.

Add ScreenShots

Add ScreenShots N/A (no UI change)

Record

  • [x] I agree to follow this project's Code of Conduct
  • [x] I want to work on this issue

Omega-127 avatar Nov 03 '26 16:11 Omega-127

👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)

github-actions[bot] avatar Nov 03 '26 16:11 github-actions[bot]

⚠️ Potential Duplicate Issue (Semantic Match)

This issue appears semantically similar to the following issues in AOSSIE-Org/PictoPy:

  1. Add unit test coverage for system health and core server endpoints (#1011, open) https://github.com/AOSSIE-Org/PictoPy/issues/1011 Similarity: 69.2%

  2. BUG: Missing 'requests' in requirements.txt causes ModuleNotFoundError in API utils (#1533, open) https://github.com/AOSSIE-Org/PictoPy/issues/1533 Similarity: 62.1%

  3. **Write Unit Tests for backend ** (#74, closed) https://github.com/AOSSIE-Org/PictoPy/issues/74 Similarity: 60.4%

Please review before proceeding.

github-actions[bot] avatar Nov 03 '26 16:11 github-actions[bot]

Link your account with Gitcord

Thanks for opening this issue, @Omega-127!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link Omega-127
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link Omega-127)

Once linked, Gitcord can notify you about assignments, mentions, and more.

— Posted by Gitcord

gitcordapp[bot] avatar Nov 03 '26 17:11 gitcordapp[bot]

Hi @rohan-pandeyy, I'd like to work on this issue.

I already have a working implementation locally and will wait for assignment before opening a PR:

  • sync-microservice/pytest.ini (pythonpath = ., testpaths = tests) mirroring backend
  • pytest and pytest-asyncio added to sync-microservice/requirements.txt (httpx was already pinned)
  • tests for app/routes/health.py, app/routes/shutdown.py (the delayed shutdown is mocked so the test process isn't killed) and app/utils/watcher_helpers.py
  • a "Run Tests (Sync Microservice)" step in .github/workflows/pr-check.yml
  • a conftest guard so tests can never touch a real PictoPy database

12 tests pass locally in a clean venv. Could you please assign this to me? Follow-up PRs can cover routes/folders.py, routes/watcher.py and utils/watcher.py.

ArnabOPP avatar Nov 19 '26 19:11 ArnabOPP