#32417: LiveServerTestCase._tearDownClassInternal() has unneeded hasattr check
--------------------------------------+------------------------------------
     Reporter:  Chris Jerdonek        |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Testing framework     |                  Version:  2.2
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * cc: Jon Dufresne (added)
 * stage:  Unreviewed => Accepted


Comment:

 Looks reasonable.

 `staticfiles_tests.test_liveserver.StaticLiveServerChecks.test_test_test`
 fails with this change, but as far as I'm aware removing
 `cls.server_thread` is only a way to avoid `_tearDownClassInternal()`
 call, so we can override it instead, e.g.:
 {{{
 diff --git a/tests/staticfiles_tests/test_liveserver.py
 b/tests/staticfiles_tests/test_liveserver.py
 index 820fa5bc89..22c4a645e7 100644
 --- a/tests/staticfiles_tests/test_liveserver.py
 +++ b/tests/staticfiles_tests/test_liveserver.py
 @@ -54,6 +54,10 @@ class StaticLiveServerChecks(LiveServerBase):
          # skip it, as setUpClass doesn't call its parent either
          pass

 +    @classmethod
 +    def _tearDownClassInternal(cls):
 +        pass
 +
      @classmethod
      def raises_exception(cls):
          try:
 @@ -64,9 +68,6 @@ class StaticLiveServerChecks(LiveServerBase):
              # app without having set the required STATIC_URL setting.")
              pass
          finally:
 -            # Use del to avoid decrementing the database thread sharing
 count a
 -            # second time.
 -            del cls.server_thread
              super().tearDownClass()

      def test_test_test(self):

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32417#comment:3>
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/067.3d89962969b6342627b23ac5203e38dc%40djangoproject.com.

Reply via email to