From: Ben Darnell Date: Sun, 21 May 2017 23:16:58 +0000 (-0400) Subject: testing: Remove deprecated get_unused_port() X-Git-Tag: v5.0.0~80^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=330729617e292ec68378ce7c3527704f1a6a0044;p=thirdparty%2Ftornado.git testing: Remove deprecated get_unused_port() This function never did a good job and has long since been deprecated in favor of bind_unused_port. --- diff --git a/docs/testing.rst b/docs/testing.rst index 334d25879..c82197385 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -36,6 +36,4 @@ .. autofunction:: bind_unused_port - .. autofunction:: get_unused_port - .. autofunction:: get_async_test_timeout diff --git a/tornado/testing.py b/tornado/testing.py index 3c30c9ee9..46c2d5e19 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -73,24 +73,6 @@ else: except ImportError: import unittest # type: ignore -_next_port = 10000 - - -def get_unused_port(): - """Returns a (hopefully) unused port number. - - This function does not guarantee that the port it returns is available, - only that a series of get_unused_port calls in a single process return - distinct ports. - - .. deprecated:: - Use bind_unused_port instead, which is guaranteed to find an unused port. - """ - global _next_port - port = _next_port - _next_port = _next_port + 1 - return port - def bind_unused_port(reuse_port=False): """Binds a server socket to an available port on localhost.