Move test infrastructure to proper locations#124
Closed
StephanMeijer wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reorganizes Django “demo/seed” and test utilities by removing the demo app, relocating factories into core/tests, and renaming/moving the demo data management command into core as seed, with corresponding updates to developer workflows (Make/Tilt/README).
Changes:
- Removed the
demoapp fromINSTALLED_APPSand deleted its defaults module. - Moved test factories into
core/tests/factories.pyand updated test imports accordingly. - Added
core.management.commands.seed(renamed fromcreate_demo) and updatedmake/Tilt/README to useseed.
Reviewed changes
Copilot reviewed 10 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/backend/find/settings.py | Removes demo from INSTALLED_APPS. |
| src/backend/demo/defaults.py | Deletes demo defaults (now inlined into seed). |
| src/backend/core/tests/test_models_services.py | Updates factories import path to core.tests.factories. |
| src/backend/core/tests/test_commands_seed.py | Renames test to seed and patches inlined constants. |
| src/backend/core/tests/test_api_documents_index_bulk.py | Updates factories import path to core.tests.factories. |
| src/backend/core/tests/test_api_documents_delete.py | Updates factories import path to core.tests.factories. |
| src/backend/core/tests/factories.py | Fixes imports after moving factories into core/tests/. |
| src/backend/core/management/commands/seed.py | Introduces seed command, inlines defaults, and replaces create_demo. |
| README.md | Updates developer instructions from make demo to make seed. |
| Makefile | Renames demo target to seed and updates bootstrap dependency. |
| bin/Tiltfile | Renames Tilt button/script to run seed instead of create_demo. |
Comments suppressed due to low confidence (3)
src/backend/core/management/commands/seed.py:175
seed()is usingservice.nameas the OpenSearch index name (e.g.,ensure_index_exists(service.name)/indices.refresh(index=service.name)), but the rest of the codebase uses the prefixed index name viaService.index_name({OPENSEARCH_INDEX_PREFIX}-{service.name}). This will seed documents into indexes the API won’t query. Useservice.index_nameconsistently here (and in the later bulk indexing / count/refresh calls).
src/backend/core/management/commands/seed.py:21- This management command imports
core.tests.factories, which pulls infactory_boy/fakerfrom the dev extras and couples runtime code to the test package. Consider moving theServiceFactoryused for seeding into a non-test module (e.g.,core/factories.pyorcore/devdata.py) or doing local object creation, and leavecore.tests.factoriesfor tests only.
src/backend/core/management/commands/seed.py:168 opensearch_client_.indices.delete(index="*")will delete every index in the cluster (including unrelated or system indices) when run in DEBUG. To reduce blast radius, consider deleting only the project’s indices (e.g.,${OPENSEARCH_INDEX_PREFIX}-*) or adding an explicit--all-indicesflag for the current behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 8, 2026
Signed-off-by: Stephan Meijer <me@stephanmeijer.com>
Collaborator
Author
|
Closed: is LaSuite convention |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
factories.pyfromcore/tocore/tests/(test utilities belong in test folders)seedmanagement command incore/(renamed fromcreate_demoindemo/app)demo/Django app (was overkill for one management command)Changes
core/factories.pycore/tests/factories.pydemo/management/commands/create_demo.pycore/management/commands/seed.pydemo/defaults.pyseed.pymake demomake seeddemo/app in INSTALLED_APPSVerification
make seedcreates 1000 documents across 5 test indexesdemomodule