test(django): Remove dead code and stale markers from the Django test suite - #7156
Draft
ericapisani wants to merge 4 commits into
Draft
test(django): Remove dead code and stale markers from the Django test suite#7156ericapisani wants to merge 4 commits into
ericapisani wants to merge 4 commits into
Conversation
The marker was added in 2019 (6326cb6) with no reason or issue reference, and the test now XPASSes across the supported Django range (verified 5.2.16 and 6.x; the already-read-body handling it exercises is stable Django public-contract behavior). A non-strict xfail that always passes can never fail the build, so the test was dead weight that would have silently xpassed a real regression. Removing the marker restores it as a genuine regression guard.
No test references rest_hello (its test was removed in a 2019-era revert cycle); every other registered URL is exercised by the suite.
Empirical audit of all 61 django_db-marked tests in the django suite: 60 are load-bearing (DB queries, login, or session-cookie loads via SessionMiddleware). The cache tests' markers also stay: stripping them broke a pytest-forked x pytest-django teardown invariant. This test is the only one that is genuinely DB-free (DRF view with no ORM work, no session cookie sent) and safe to unmark.
AST-verified unused: capture_events in test_materialized_user_captured (never called), client in 6 raw-cursor executemany tests (no HTTP). Unrequested fixtures are never built, so removal is behavior-neutral; signatures now truthfully describe each test's dependencies.
Contributor
Codecov Results 📊✅ 103984 passed | ⏭️ 6677 skipped | Total: 110661 | Pass Rate: 93.97% | Execution Time: 360m 51s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2485 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 90.15% 90.12% -0.03%
==========================================
Files 193 193 —
Lines 25147 25147 —
Branches 9136 9136 —
==========================================
+ Hits 22669 22662 -7
- Misses 2478 2485 +7
- Partials 1431 1431 —Generated by Codecov Action |
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.
Description
Cleanup pass over the Django test suite, no change in what is covered:
xfailontest_read_request(the test passes — it currently reports asxpass)django_dbmarker ontest_response_tracerest_helloview and its URL entry in the test appclientfixture argument on 7 test signaturesFirst of four PRs trimming redundancy from this suite (391 -> 312 cases overall). This one doesn't change this, is a cleanup PR.
Refs PY-2641
Refs #6975