﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32417	LiveServerTestCase._tearDownClassInternal() has unneeded hasattr check	Chris Jerdonek	Chris Jerdonek	"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.
"	Cleanup/optimization	closed	Testing framework	2.2	Normal	fixed		Jon Dufresne Florian Apolloner	Ready for checkin	1	0	0	0	0	0
