#32417: LiveServerTestCase's tearDownClass() not symmetric with setUpClass()
------------------------------------------+------------------------
Reporter: Chris Jerdonek | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
I noticed that #30171
[https://github.com/django/django/commit/37cc6a9dce3354cd37f23ee972bc25b0e5cebd5c
#diff-
7833da5b45a68d00834388d97dd5c4413e3796497c7bc5e0cc2621b08a2d0df1L1481-R1483
removed some setup/teardown symmetry] in `LiveServerTestCase` that it
seems like would be better to keep.
Specifically, `LiveServerTestCase.setUpClass()` unconditionally calls
`inc_thread_sharing()` on certain connections:
https://github.com/django/django/blob/37cc6a9dce3354cd37f23ee972bc25b0e5cebd5c/django/test/testcases.py#L1437-L1452
but in `_tearDownClassInternal()`, after the above change it does the
reverse only conditionally -- based on whether the `server_thread`
attribute is present. In particular, if `_create_server_thread()` errors
out, which is what sets `server_thread`, then the connections won't be
restored to their initial state inside `_tearDownClassInternal()`.
It seems like the restoration should happen unconditionally in
`_tearDownClassInternal()`, which is how it was before #30171.
--
Ticket URL: <https://code.djangoproject.com/ticket/32417>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.78ad0d5276f9192d1283ea6ebb1a3121%40djangoproject.com.