Skip to content

Commit b66ca87

Browse files
authored
Merge pull request #2347 from opentensor/tests/roman/add-parsing-test-for-py-config-via-rust-wallet
add config test
2 parents 1d963df + 66edd49 commit b66ca87

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

requirements/prod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ python-Levenshtein
2121
scalecodec==1.2.11
2222
substrate-interface~=1.7.9
2323
uvicorn
24-
bittensor-wallet==2.0.1
24+
bittensor-wallet>=2.0.2

tests/unit_tests/test_config.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import bittensor
2+
import argparse
3+
4+
5+
def test_py_config_parsed_successfully_rust_wallet():
6+
"""Verify that python based config object is successfully parsed with rust-based wallet object."""
7+
# Preps
8+
parser = argparse.ArgumentParser()
9+
10+
bittensor.wallet.add_args(parser)
11+
bittensor.subtensor.add_args(parser)
12+
bittensor.axon.add_args(parser)
13+
bittensor.logging.add_args(parser)
14+
15+
config = bittensor.config(parser)
16+
17+
# since we can't apply mocking to rust implewmented object then replace those directly
18+
config.wallet.name = "new_wallet_name"
19+
config.wallet.hotkey = "new_hotkey"
20+
config.wallet.path = "/some/not_default/path"
21+
22+
wallet = bittensor.wallet(config=config)
23+
24+
# Asserts
25+
assert wallet.name == config.wallet.name
26+
assert wallet.hotkey_str == config.wallet.hotkey
27+
assert wallet.path == config.wallet.path

0 commit comments

Comments
 (0)