Skip to content

Commit

Permalink
Skip bitsandbytes warnings about cpu-only versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mryab committed Aug 22, 2022
1 parent 98fcb80 commit 01d41ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/test_cli_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_dht_connection_successful():

# skip bitsandbytes warning
_ = dht_proc.stderr.readline()
_ = dht_proc.stderr.readline()
first_line = dht_proc.stderr.readline()
second_line = dht_proc.stderr.readline()
dht_pattern_match = DHT_START_PATTERN.search(first_line)
Expand All @@ -33,11 +34,11 @@ def test_dht_connection_successful():
)

# skip first three lines with connectivity and bitsandbytes info
for _ in range(3):
for _ in range(4):
dht_client_proc.stderr.readline()
first_report_msg = dht_client_proc.stderr.readline()

assert "2 DHT nodes (including this one) are in the local routing table" in first_report_msg
assert "2 DHT nodes (including this one) are in the local routing table" in first_report_msg, first_report_msg

# ensure we get the output of dht_proc after the start of dht_client_proc
sleep(dht_refresh_period)
Expand Down
16 changes: 12 additions & 4 deletions tests/test_start_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def test_background_server_identity_path():
with background_server(num_experts=1, identity_path=id_path) as server_info_1, background_server(
num_experts=1, identity_path=id_path
) as server_info_2, background_server(num_experts=1, identity_path=None) as server_info_3:

assert server_info_1.peer_id == server_info_2.peer_id
assert server_info_1.peer_id != server_info_3.peer_id
assert server_info_3.peer_id == server_info_3.peer_id
Expand All @@ -34,10 +33,13 @@ def test_cli_run_server_identity_path():

# Skip line "UserWarning: The installed version of bitsandbytes was compiled without GPU support. <...>"
_ = server_1_proc.stderr.readline()
_ = server_1_proc.stderr.readline()
# Skip line "Generating new identity (libp2p private key) in {path to file}"
_ = server_1_proc.stderr.readline()
line = server_1_proc.stderr.readline()
addrs_1 = set(re.search(pattern, line).group(1).split(", "))
addrs_pattern_result = re.search(pattern, line)
assert addrs_pattern_result is not None, line
addrs_1 = set(addrs_pattern_result.group(1).split(", "))
ids_1 = set(a.split("/")[-1] for a in addrs_1)

assert len(ids_1) == 1
Expand All @@ -51,8 +53,11 @@ def test_cli_run_server_identity_path():

# Skip line "UserWarning: The installed version of bitsandbytes was compiled without GPU support. <...>"
_ = server_2_proc.stderr.readline()
_ = server_2_proc.stderr.readline()
line = server_2_proc.stderr.readline()
addrs_2 = set(re.search(pattern, line).group(1).split(", "))
addrs_pattern_result = re.search(pattern, line)
assert addrs_pattern_result is not None, line
addrs_2 = set(addrs_pattern_result.group(1).split(", "))
ids_2 = set(a.split("/")[-1] for a in addrs_2)

assert len(ids_2) == 1
Expand All @@ -66,8 +71,11 @@ def test_cli_run_server_identity_path():

# Skip line "UserWarning: The installed version of bitsandbytes was compiled without GPU support. <...>"
_ = server_3_proc.stderr.readline()
_ = server_3_proc.stderr.readline()
line = server_3_proc.stderr.readline()
addrs_3 = set(re.search(pattern, line).group(1).split(", "))
addrs_pattern_result = re.search(pattern, line)
assert addrs_pattern_result is not None, line
addrs_3 = set(addrs_pattern_result.group(1).split(", "))
ids_3 = set(a.split("/")[-1] for a in addrs_3)

assert len(ids_3) == 1
Expand Down

0 comments on commit 01d41ca

Please sign in to comment.