def test_bind_ephemeral_port(self):
        """
        A server configured to bind to port 0 will bind to an ephemeral
        port and indicate that port number on startup.
        """
        cherrypy.config.reset()
        bind_ephemeral_conf = {
            'server.socket_port': 0,
        }
        cherrypy.config.update(bind_ephemeral_conf)
        cherrypy.engine.start()
        assert cherrypy.server.bound_addr != cherrypy.server.bind_addr
        _host, port = cherrypy.server.bound_addr
        assert port > 0
        cherrypy.engine.stop()
        assert cherrypy.server.bind_addr == cherrypy.server.bound_addr

        A server configured to bind to port 0 will bind to an ephemeral
        port and indicate that port number on startup.
        
cherrypy/test/test_core.py