The test should really only be calling the full `setUpClass()` and
`tearDownClass()` once (but still doing the partial setup and tear-down
that it needs for the purposes of its test).
--
Ticket URL: <https://code.djangoproject.com/ticket/27079>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* component: Uncategorized => Testing framework
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:1>
* owner: nobody => cjerdonek
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:2>
Comment (by cjerdonek):
[https://github.com/django/django/pull/7096 This] merged pull request
removed calling `tearDownClass()` twice (because it blocked the resolution
of that issue), so I'm retitling this ticket to reflect the updated
situation.
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:3>
* owner: Chris Jerdonek => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:4>
Comment (by Jacob Walls):
Replying to [comment:3 Chris Jerdonek]:
> [https://github.com/django/django/pull/7096 This] merged pull request
removed calling `tearDownClass()` twice (because it blocked the resolution
of that issue), so I'm retitling this ticket to reflect the updated
situation.
Chris, is it the case that the changes you referred to were undone in
8c775391b78b2a4a2b57c5e89ed4888f36aada4b? Perhaps we could revert to the
original issue title (and include the test that follows it)?
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:5>
Comment (by Chris Jerdonek):
> Chris, is it the case that the changes you referred to were undone in
8c775391b78b2a4a2b57c5e89ed4888f36aada4b? Perhaps we could revert to the
original issue title (and include the test that follows it)?
Nice observation, Jacob. More specifically, it was done
[https://github.com/django/django/commit/8c775391b78b2a4a2b57c5e89ed4888f36aada4b
#diff-
c0d7a27759b0649539ed852dde69da3527fc718af1806dc28b93697d3dd0ceb4L212-R212
in these lines] and below.
Do you want to go ahead with what you suggest? It could also help to
comment on that PR so the connection between the tickets is more
noticeable.
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:6>
Comment (by Jacob Walls):
Back to the original state of play after changes in #28478. My
understanding is that we should tailor the setup and cleanup in these two
tests rather than make extra calls to the class methods.
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:7>
* owner: (none) => Jacob Walls
* status: new => assigned
* type: Bug => Cleanup/optimization
Comment:
> Back to the original state of play after changes in #28478.
Actually, not quite the original state of play. `allow_thread_sharing` was
removed in #30171 in favor of a counter pattern which obviates the
reported bug here. I still think Chris's suggestion has value, but it's
more of a cleanup opportunity, if I'm not mistaken.
Having touched this a couple times I ought to just finish it off.
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:8>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/15007 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:9>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:10>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:11>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:12>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"def09bf4126d4886413adf7388882eca8e32576b" def09bf]:
{{{
#!CommitTicketReference repository=""
revision="def09bf4126d4886413adf7388882eca8e32576b"
Fixed #27079 -- Avoided multiple setUpClass()/tearDownClass() calls in
LiveServerTestCase tests.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"534895f1ace819053f28463fd62b833ba2ced829" 534895f]:
{{{
#!CommitTicketReference repository=""
revision="534895f1ace819053f28463fd62b833ba2ced829"
[4.0.x] Fixed thread termination in servers.tests.LiveServerPort on Python
< 3.10.9.
TestCase.doClassCleanups() cannot be called on Python < 3.10.9 because
setUpClass()/tearDownClass() are called multiple times in
LiveServerTestCase tests (refs #27079).
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:14>
Comment (by GitHub <noreply@…>):
In [changeset:"d6e9ec40145b9edc65e8d0c65bd3f4ef8a7a27bb" d6e9ec4]:
{{{
#!CommitTicketReference repository=""
revision="d6e9ec40145b9edc65e8d0c65bd3f4ef8a7a27bb"
Refs #27079 -- Used addClassCleanup() in SeleniumTestCase.
Regression in def09bf4126d4886413adf7388882eca8e32576b.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27079#comment:15>