-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathtest_info.py
39 lines (28 loc) · 901 Bytes
/
test_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pytest
import ucp
@pytest.fixture(autouse=True)
def reset():
ucp.reset()
yield
ucp.reset()
def test_context_info():
info = ucp.get_ucp_context_info()
assert isinstance(info, str)
def test_worker_info():
info = ucp.get_ucp_worker_info()
assert isinstance(info, str)
@pytest.mark.parametrize(
"transports",
["posix", "tcp", "posix,tcp"],
)
def test_check_transport(transports):
transports_list = transports.split(",")
inactive_transports = list(set(["posix", "tcp"]) - set(transports_list))
ucp.reset()
options = {"TLS": transports, "NET_DEVICES": "all"}
ucp.init(options)
active_transports = ucp.get_active_transports()
for t in transports_list:
assert any([at.startswith(t) for at in active_transports])
for it in inactive_transports:
assert any([not at.startswith(it) for at in active_transports])