Ports related utility functions#

Ports related utility functions.

pytestskipmarkers.utils.ports.get_unused_localhost_port(use_cache=False)[source]#

Return a random unused port on localhost.

Parameters:
  • use_cache (bool) – If use_cache is True, consecutive calls to this function will never return the cached port.

  • use_cache

Return type:

int

pytestskipmarkers.utils.ports.get_connectable_ports(ports)[source]#

Returns a set of the ports where connection was successful.

Parameters:

ports (Iterable) – An iterable of ports to try and connect to

Return type:

set

Returns:

Returns a set of the ports where connection was successful