Skip to content

Commit ab7de69

Browse files
PortManager::find_free_port is updated
We will use exclude_ports only when it is not none. Creation of empty exclude_ports is removed.
1 parent 4453e8f commit ab7de69

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

testgres/helpers/port_manager.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ 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-
if exclude_ports is None:
30-
exclude_ports = set()
31-
32-
ports.difference_update(set(exclude_ports))
29+
if exclude_ports is not None:
30+
ports.difference_update(set(exclude_ports))
3331

3432
sampled_ports = random.sample(tuple(ports), min(len(ports), 100))
3533

0 commit comments

Comments
 (0)