#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.
--
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/060.77aa737a2fd8610f159c304ec8f9bdf5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.