'LiveServerTestCase.port customizes the server\'s port.'

def test_specified_port_bind(self):

    TestCase = type(str('TestCase'), (LiveServerBase,), {})
    s = socket.socket()
    s.bind(('', 0))
    TestCase.port = s.getsockname()[1]
    s.close()
    TestCase.setUpClass()
    try:
        self.assertEqual(TestCase.port, TestCase.server_thread.port, ('Did    not    use    specified    port    for    LiveServerTestCase    thread:    %s' % TestCase.port))
    finally:
        if hasattr(TestCase, 'server_thread'):
            TestCase.server_thread.terminate()
