-
Notifications
You must be signed in to change notification settings - Fork 3
Setup for optional django dependency and unit testing with/without django #159
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce optional Django 5.2 support to the project. The workflow is updated to test with and without Django, optional dependency and classifiers are added to project metadata, documentation is updated with Django installation instructions, and new test utilities with conditional skip markers are introduced. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
48eb807 to
e42bdf8
Compare
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (99.91%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #159 +/- ##
===========================================
- Coverage 98.96% 98.92% -0.04%
===========================================
Files 40 42 +2
Lines 2121 2141 +20
===========================================
+ Hits 2099 2118 +19
- Misses 22 23 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/unit_tests.yml (1)
28-50: Fix Django install guard (bash test is invalid for "5.2").
The condition uses integer-gtagainst a non-integer version and is missing a space before], so the step will fail on the Django build.✅ Proposed fix
- if [ "${{ matrix.django }}" -gt "0"]; then pip install -q Django==${{ matrix.django }} pytest-django; fi + if [ "${{ matrix.django }}" != "0" ]; then + pip install -q "Django==${{ matrix.django }}" pytest-django + fi
🤖 Fix all issues with AI agents
In `@src/undate/test_utils.py`:
- Around line 1-26: Add inline mypy ignores to the imports so static checking
won't fail: add "# type: ignore[import]" to the pytest import and to the django
import inside the try/except (or use "# type: ignore[import]" on the django
import line and keep the runtime fallback django = None), then leave the
existing skipif_no_django and skipif_django definitions using
pytest.mark.skipif(django is None, ...) and pytest.mark.skipif(django, ...).
This targets the import statements for pytest and django in test_utils.py to
silence "Library stubs not found" / "Unresolved import" mypy errors.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/unit_tests.ymlREADME.mdpyproject.tomlsrc/undate/django/__init__.pysrc/undate/test_utils.pytests/test_django/test_django_setup.py
🧰 Additional context used
🪛 GitHub Actions: Check style + docs + types
src/undate/test_utils.py
[error] 17-17: Cannot find implementation or library stub for module named "pytest" [import-not-found]
[error] 20-20: Cannot find implementation or library stub for module named "django" [import-not-found]
🔇 Additional comments (3)
pyproject.toml (1)
43-44: LGTM — Django metadata/extras look consistent.Also applies to: 58-58
README.md (1)
46-51: LGTM — optional Django install note is clear.tests/test_django/test_django_setup.py (1)
1-16: LGTM — conditional tests match the skip markers.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Resolves #152
Changes in this PR:
undate.djangomoduleTo check locally, if desired:
Questions & notes:
test_utilsin the main package because the tests directory isn't currently setup as a python module, but it's seems a little awkward there (mypy check is failing, and it requires pytest, which is a dev/test requirement). Thoughts?@requires_djangodecorator, would that be useful to add? https://github.com/Princeton-CDH/parasolr/blob/main/parasolr/django/util.pySummary by CodeRabbit
Release Notes
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.