Skip to content

Commit 27c40d2

Browse files
PortManager::find_free_port is updated
Asserts are added: - ports must be the "set" - exclude_ports must be iterable Do not convert exclude_ports into "set" [optimization?]
1 parent ab7de69 commit 27c40d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

testgres/helpers/port_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ def find_free_port(self, ports: Optional[Set[int]] = None, exclude_ports: Option
2626
if ports is None:
2727
ports = set(range(1024, 65535))
2828

29+
assert type(ports) == set
30+
2931
if exclude_ports is not None:
30-
ports.difference_update(set(exclude_ports))
32+
assert isinstance(exclude_ports, Iterable)
33+
ports.difference_update(exclude_ports)
3134

3235
sampled_ports = random.sample(tuple(ports), min(len(ports), 100))
3336

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy