]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
testing: Remove deprecated get_unused_port()
authorBen Darnell <ben@bendarnell.com>
Sun, 21 May 2017 23:16:58 +0000 (19:16 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 21 May 2017 23:16:58 +0000 (19:16 -0400)
This function never did a good job and has long since been deprecated
in favor of bind_unused_port.

docs/testing.rst
tornado/testing.py

index 334d258799df1dc79672e92b5578e6c64553db21..c8219738556a00de2ac939c3a4a04c5b57f96b9e 100644 (file)
@@ -36,6 +36,4 @@
 
    .. autofunction:: bind_unused_port
 
-   .. autofunction:: get_unused_port
-
    .. autofunction:: get_async_test_timeout
index 3c30c9ee9b2bf8e1d3deaf2543c311e83098f73e..46c2d5e1997db2d3a34723e097b147a23ef8da5c 100644 (file)
@@ -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.