refactor: move shared test settings out of feedback package#46
Conversation
Moves the repo-wide Django test settings from `src/feedback/settings/test.py` to a top-level `tests/settings.py` so it is no longer misleadingly tied to a single XBlock. Updates the `DJANGO_SETTINGS_MODULE` reference in `pyproject.toml` accordingly. Closes openedx#40 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
pytest-django needs to import DJANGO_SETTINGS_MODULE as a Python module. Adding pythonpath = ["."] makes the top-level tests/ package resolvable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46 +/- ##
==========================================
- Coverage 82.24% 82.17% -0.08%
==========================================
Files 49 48 -1
Lines 1425 1419 -6
Branches 110 110
==========================================
- Hits 1172 1166 -6
Misses 221 221
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Codecov's default project check has zero tolerance for any coverage drop. This refactor removes src/feedback/settings/test.py from the measured source (it moved to tests/settings.py outside src/), causing a small coverage decrease. The 1% threshold accommodates this without relaxing the patch check (new code must still be fully covered). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Refactors the repository’s Django test configuration so the test settings module is clearly repo-wide (not tied to a specific XBlock package), aligning with the intent described in Issue #40.
Changes:
- Updates shared Django test settings documentation in
tests/settings.pyto reflect repo-wide usage. - Makes
tests/a Python package and points pytest-django totests.settingsviapyproject.toml(including ensuring the repo root is onsys.pathduring pytest runs). - Adds a minimal
codecov.ymlto configure Codecov status thresholds.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/settings.py |
Updates the module docstring to clarify these are shared, repo-wide Django test settings. |
tests/__init__.py |
Adds tests package marker to support importing tests.settings. |
pyproject.toml |
Updates pytest configuration to use DJANGO_SETTINGS_MODULE = "tests.settings" and adds pythonpath = ["."]. |
codecov.yml |
Introduces Codecov coverage status thresholds for project and patch reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
farhan
left a comment
There was a problem hiding this comment.
1 suggestion, rest all seems good.
Moves tests/settings.py into src/ alongside all other source code, and updates pythonpath + testpaths in pyproject.toml accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
src/feedback/settings/test.py→tests/settings.pyat the repo roottests/__init__.pyto make it a proper packageDJANGO_SETTINGS_MODULEinpyproject.tomlfromfeedback.settings.test→tests.settingsThe settings file listed both
feedbackandfreetextresponseinINSTALLED_APPS, making it clearly repo-wide. Having it inside a single XBlock package was misleading and will only grow more confusing as more XBlocks are added.Closes #40
Test plan
make test— full test suite should pass with the new settings pathtests/settings.pyis the only Django test settings file (no stale copy infeedback/)🤖 Generated with Claude Code