[Django] #29305: GET or POST requests outside of the browser to the LiveServerTestCase hang

9 views
Skip to first unread message

Django

unread,
Apr 9, 2018, 11:34:23 AM4/9/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase hang
---------------------------------------------+------------------------
Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Keywords: Test
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
We have an integration test where we start two separate Django processes
and the second process makes a POST request to the first process with the
requests library. This testcase broke once we upgraded to Django 1.11,
while it still worked in Django 1.10.

To reproduce the issue:

- Create a simple Django app.
- Install selenium and requests
- Add a testcase like so:


{{{#!python
import time

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.urls import reverse
from selenium import webdriver


class TestExample(StaticLiveServerTestCase):
def test_example(self):
driver = webdriver.Chrome()
driver.get(self.live_server_url + reverse('admin:index'))
# wait "forever"
time.sleep(60 * 60 * 24)
}}}

I.e it just opens the admin page, then waits for 24 hours. In a Python
console, type the following:

{{{#!python
import requests
requests.get('http://localhost:47256/admin')
}}}

and you will see that the request hangs indefinitely. Interestingly, it
sometimes helps to press refresh in the Chrome window spawned by Selenium.

--
Ticket URL: <https://code.djangoproject.com/ticket/29305>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 9, 2018, 11:35:25 AM4/9/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Santiago García:

Old description:

New description:

We have an integration test where we start two separate Django processes
and the second process makes a POST request to the first process with the
requests library. This testcase broke once we upgraded to Django 1.11,
while it still worked in Django 1.10.

To reproduce the issue:

- Create a simple Django app.
- Install selenium and requests
- Add a testcase like so:


{{{#!python
import time

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.urls import reverse
from selenium import webdriver


class TestExample(StaticLiveServerTestCase):
def test_example(self):
driver = webdriver.Chrome()
driver.get(self.live_server_url + reverse('admin:index'))
# wait "forever"
time.sleep(60 * 60 * 24)
}}}

I.e it just opens the admin page, then waits for 24 hours. In a Python
console, type the following:

{{{#!python
import requests
requests.get('http://localhost:47256/admin') # replace 47256 with whatever
port number the LiveServerTestCase picked
}}}

and you will see that the request hangs indefinitely. Interestingly, it
sometimes helps to press refresh in the Chrome window spawned by Selenium.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:1>

Django

unread,
Apr 9, 2018, 11:36:09 AM4/9/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:2>

Django

unread,
Apr 9, 2018, 11:36:56 AM4/9/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Santiago García:

Old description:

> We have an integration test where we start two separate Django processes


> and the second process makes a POST request to the first process with the
> requests library. This testcase broke once we upgraded to Django 1.11,
> while it still worked in Django 1.10.
>
> To reproduce the issue:
>
> - Create a simple Django app.
> - Install selenium and requests
> - Add a testcase like so:
>

> {{{#!python
> import time
>
> from django.contrib.staticfiles.testing import StaticLiveServerTestCase
> from django.urls import reverse
> from selenium import webdriver
>

> class TestExample(StaticLiveServerTestCase):
> def test_example(self):
> driver = webdriver.Chrome()
> driver.get(self.live_server_url + reverse('admin:index'))
> # wait "forever"
> time.sleep(60 * 60 * 24)
> }}}
>
> I.e it just opens the admin page, then waits for 24 hours. In a Python
> console, type the following:
>
> {{{#!python
> import requests

> requests.get('http://localhost:47256/admin') # replace 47256 with
> whatever port number the LiveServerTestCase picked
> }}}
>

> and you will see that the request hangs indefinitely. Interestingly, it
> sometimes helps to press refresh in the Chrome window spawned by
> Selenium.

New description:

We have an integration test where we start two separate Django processes
and the second process makes a POST request to the first process with the
requests library. This testcase broke once we upgraded to Django 1.11,
while it still worked in Django 1.10.

To reproduce the issue:

- Create a simple Django app.
- Install selenium and requests
- Add a testcase like so:


{{{#!python
import time

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.urls import reverse
from selenium import webdriver


class TestExample(StaticLiveServerTestCase):
def test_example(self):
driver = webdriver.Chrome()
driver.get(self.live_server_url + reverse('admin:index'))
# wait "forever"
time.sleep(60 * 60 * 24)
}}}

I.e it just opens the admin page in Chrome, then waits for 24 hours. In a


Python console, type the following:

{{{#!python
import requests


requests.get('http://localhost:47256/admin') # replace 47256 with whatever
port number the LiveServerTestCase picked
}}}

and you will see that the request hangs indefinitely. Interestingly, it


sometimes helps to press refresh in the Chrome window spawned by Selenium.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:3>

Django

unread,
Apr 9, 2018, 11:41:04 AM4/9/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Santiago García:

Old description:

> We have an integration test where we start two separate Django processes


> and the second process makes a POST request to the first process with the
> requests library. This testcase broke once we upgraded to Django 1.11,
> while it still worked in Django 1.10.
>
> To reproduce the issue:
>
> - Create a simple Django app.
> - Install selenium and requests
> - Add a testcase like so:
>

> {{{#!python
> import time
>
> from django.contrib.staticfiles.testing import StaticLiveServerTestCase
> from django.urls import reverse
> from selenium import webdriver
>

> class TestExample(StaticLiveServerTestCase):
> def test_example(self):
> driver = webdriver.Chrome()
> driver.get(self.live_server_url + reverse('admin:index'))
> # wait "forever"
> time.sleep(60 * 60 * 24)
> }}}
>

> I.e it just opens the admin page in Chrome, then waits for 24 hours. In a


> Python console, type the following:
>
> {{{#!python
> import requests

> requests.get('http://localhost:47256/admin') # replace 47256 with
> whatever port number the LiveServerTestCase picked
> }}}
>

> and you will see that the request hangs indefinitely. Interestingly, it
> sometimes helps to press refresh in the Chrome window spawned by
> Selenium.

New description:

We have an integration test where we start two separate Django processes
and the second process makes a POST request to the first process with the
requests library. This testcase broke once we upgraded to Django 1.11,
while it still worked in Django 1.10.

To reproduce the issue:

- Create a simple Django app.
- Install selenium and requests
- Add a testcase like so:


{{{#!python
import time

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.urls import reverse
from selenium import webdriver


class TestExample(StaticLiveServerTestCase):
def test_example(self):
driver = webdriver.Chrome()
driver.get(self.live_server_url + reverse('admin:index'))
# wait "forever"
time.sleep(60 * 60 * 24)
}}}

I.e it just opens the admin page in Chrome, then waits for 24 hours. In a


Python console, type the following:

{{{#!python
import requests


requests.get('http://localhost:47256/admin') # replace 47256 with whatever
port number the LiveServerTestCase picked
}}}

and you will see that the request hangs indefinitely. Interestingly, it


sometimes helps to press refresh in the Chrome window spawned by Selenium.

I am seeing this issue on Windows 7 and Windows 10 machines

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:4>

Django

unread,
Apr 11, 2018, 11:48:46 AM4/11/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by Tim Graham):

I can reproduce with Django 1.11.x but not with Django 2.0.x. Do you get
the same result? If so, it might be a bit late to fix the issue for Django
1.11.x unless the fix is trivial.

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:5>

Django

unread,
Apr 12, 2018, 4:45:45 AM4/12/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.11
Severity: Normal | Resolution:

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by Santiago García):

Yes, it does work for me on Django 2.0

--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:6>

Django

unread,
Apr 15, 2018, 9:03:30 PM4/15/18
to django-...@googlegroups.com
#29305: GET or POST requests outside of the browser to the LiveServerTestCase
server hang
-----------------------------------+--------------------------------------

Reporter: Santiago García | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.11
Severity: Normal | Resolution: wontfix

Keywords: Test | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => wontfix


--
Ticket URL: <https://code.djangoproject.com/ticket/29305#comment:7>

Reply all
Reply to author
Forward
0 new messages