Fixed #20238 -- Added threading support to LiveServerTestCase.

This commit is contained in:
Nadège Michel 2016-12-06 20:38:43 +01:00 committed by Tim Graham
parent c4e2fc5d98
commit bece837829
6 changed files with 44 additions and 3 deletions

View file

@ -130,3 +130,19 @@ class LiveServerPort(LiveServerBase):
finally:
if hasattr(TestCase, 'server_thread'):
TestCase.server_thread.terminate()
class LiverServerThreadedTests(LiveServerBase):
"""If LiverServerTestCase isn't threaded, these tests will hang."""
def test_view_calls_subview(self):
url = '/subview_calling_view/?%s' % urlencode({'url': self.live_server_url})
with self.urlopen(url) as f:
self.assertEqual(f.read(), b'subview calling view: subview')
def test_check_model_instance_from_subview(self):
url = '/check_model_instance_from_subview/?%s' % urlencode({
'url': self.live_server_url,
})
with self.urlopen(url) as f:
self.assertIn(b'emily', f.read())