#27596: LiveServerTestCase in 1.10.4 doesnt close server ports properly
-----------------------------------+--------------------------------------
     Reporter:  Mike Hibbert       |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  1.10
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------

Comment (by Marten Kenbeek):

 I think the issue stems from
 
[https://github.com/gabrielfalcao/lettuce/blob/6d68a72e3b89f6f05d7805845b61cd15be3ac6ce/lettuce/django/server.py#L347
 this line] and
 
[https://github.com/gabrielfalcao/lettuce/blob/6d68a72e3b89f6f05d7805845b61cd15be3ac6ce/lettuce/django/server.py#L248
 this one]. By forcing Django to use a single port, the
 `LiveServerTestCase` won't try any other ports, so if that specific port
 is in use, it simply fails. `allow_reuse_address = False` may increase the
 live-span of connections that block the port, but lettuce would have the
 same problems when you use parallel testing of any sort, even when just
 running two separate test runners side by side (e.g. on a CI platform).
 Using an address range or port 0 largely avoids all these problems.

 For now you can probably fix the error on your end by setting
 `LETTUCE_SERVER_PORT = '8081-8179'` in your test settings, which is the
 default range used by Django.

 Django's current master has switched to using port 0, which delegates the
 choice to the operating system. That should avoid any problems with
 addresses that are already in use, and it may be a good solution for
 lettuce to adopt as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/27596#comment:11>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.1e2f1f516100fb610937495c9f7f356b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to