Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: Move unit tests to a subdirectory to allow space for integration tests #544

Merged
merged 27 commits into from
Aug 13, 2024

Conversation

malexw
Copy link
Collaborator

@malexw malexw commented Jul 31, 2024

As part of a larger series of testing improvements, this change moves all the current python tests from backend/tests to the subdirectory backend/tests/unit. This gives us room to add a directory for integration tests with their own config.

AI Description

This PR introduces changes to the Makefile and updates several test files.

Makefile

  • Adds new targets: watch, up, down, run-unit-tests, run-community-tests, run-integration-tests, attach, exec-backend, exec-db, migration, migrate, downgrade, reset-db, setup, setup-use-community, win-setup, lint, first-run, win-first-run, generate-client-web, and install-web.
  • Updates the run-tests target to include run-unit-tests.
  • Removes the run-tests target's dependency on build.

Test Files

  • Moves several test files from src/backend/tests/ to src/backend/tests/unit/: configuration.yaml, conftest.py, test_deployments.py, test_agent.py, test_agent_tool_metadata.py, test_blacklist.py, test_citation.py, test_conversation.py, test_document.py, test_file.py, test_message.py, test_organization.py, test_snapshot.py, test_tool_call.py, and test_user.py.
  • Updates import statements in the moved test files to use the new path.
  • Removes the src/backend/tests/factories/ and src/backend/tests/model_deployments/mock_deployments/ directories and their contents.
  • Adds a new file, src/backend/tests/unit/factories/__init__.py, containing the same contents as the removed src/backend/tests/factories/__init__.py.

@malexw malexw marked this pull request as ready for review August 1, 2024 16:00
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 97.30769% with 7 lines in your changes missing coverage. Please review.

Project coverage is 77.10%. Comparing base (4edacee) to head (a1172aa).
Report is 139 commits behind head on main.

Files Patch % Lines
...ests/unit/services/auth/test_request_validators.py 90.69% 4 Missing ⚠️
src/backend/tests/unit/tools/test_lang_chain.py 0.00% 2 Missing ⚠️
src/backend/tests/unit/conftest.py 98.82% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #544      +/-   ##
==========================================
- Coverage   81.38%   77.10%   -4.29%     
==========================================
  Files         199      238      +39     
  Lines        8354    10455    +2101     
==========================================
+ Hits         6799     8061    +1262     
- Misses       1555     2394     +839     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.github/workflows/backend_integration_tests.yml Outdated Show resolved Hide resolved
.github/workflows/backend_unit_tests.yml Outdated Show resolved Hide resolved
.github/workflows/backend_unit_tests.yml Outdated Show resolved Hide resolved
.github/workflows/backend_unit_tests.yml Show resolved Hide resolved
@BeatrixCohere BeatrixCohere merged commit 6e7f791 into main Aug 13, 2024
6 checks passed
@BeatrixCohere BeatrixCohere deleted the alexw/init-integration-tests branch August 13, 2024 12:48
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.

4 participants