@@ -77,7 +77,7 @@ def test_is_process_on_port_both_protocols():
7777 ipv4_socket .close ()
7878
7979
80- @pytest .mark .parametrize ("port" , [1 , 80 , 443 , 8000 , 3000 , 65535 ])
80+ @pytest .mark .parametrize ("port" , [0 , 1 , 80 , 443 , 8000 , 3000 , 65535 ])
8181def test_is_process_on_port_various_ports (port ):
8282 """Test is_process_on_port with various port numbers.
8383
@@ -90,25 +90,6 @@ def test_is_process_on_port_various_ports(port):
9090 assert isinstance (result , bool )
9191
9292
93- def test_is_process_on_port_privileged_port ():
94- """Test is_process_on_port handles privileged ports gracefully."""
95- # Port 1 is typically privileged and should return True if we can't bind
96- # (either because something is running or we don't have permission)
97- result = is_process_on_port (1 )
98- assert isinstance (result , bool )
99-
100-
101- def test_is_process_on_port_invalid_port ():
102- """Test is_process_on_port with invalid port numbers."""
103- # Test with port 0 (should be handled gracefully)
104- result = is_process_on_port (0 )
105- assert isinstance (result , bool )
106-
107- # Test with port out of range (should handle OSError gracefully)
108- result = is_process_on_port (65536 )
109- assert isinstance (result , bool )
110-
111-
11293def test_is_process_on_port_mock_socket_error ():
11394 """Test is_process_on_port handles socket errors gracefully."""
11495 with mock .patch ("socket.socket" ) as mock_socket :
0 commit comments