未验证 提交 ac0c1750 编写于 作者: C Caio Carrara

Merge remote-tracking branch 'clebergnu/test_utils_network_netifaces_dep'

Signed-off-by: NCaio Carrara <ccarrara@redhat.com>
import netifaces
import socket
import unittest
......@@ -7,6 +6,12 @@ try:
except ImportError:
import mock
try:
import netifaces
HAS_NETIFACES = True
except ImportError:
HAS_NETIFACES = False
from avocado.utils import network
......@@ -52,6 +57,8 @@ def get_all_local_addrs():
class FreePort(unittest.TestCase):
@unittest.skipUnless(HAS_NETIFACES,
"netifaces library not available")
def test_is_port_free(self):
port = network.find_free_port(sequent=False)
self.assertTrue(network.is_port_free(port, "localhost"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册