Skip to content

Commit f0a7001

Browse files
authored
Merge pull request #2869 from opentensor/feat/roman/use-subtensor_api-interface-for-e2e-tests
Improve e2e tests and fix bug in SubtensorApi
2 parents 920a1e7 + 8dd99a9 commit f0a7001

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ pytest tests/unit_tests
234234
- using a compiler based on the substrait code
235235
- using an already built docker image (docker runner)
236236

237+
#### Local environment variables:
238+
- `LOCALNET_SH_PATH` - path to `localnet.sh` script in cloned subtensor repository (for legacy runner);
239+
- `BUILD_BINARY` - (`=0` or `=1`) - used with `LOCALNET_SH_PATH` for build or not before start localnet node (for legacy runner);
240+
- `USE_DOCKER` - (`=0` or `=1`) - used if you want to use specific runner to run e2e tests (for docker runner);
241+
- `FAST_BLOCKS` - (`=0` or `=1`) - allows you to run a localnet node in fast or non-fast blocks mode (for both types of runers).
242+
237243
#### Using `docker runner` (default for now):
238244
- E2E tests with docker image do not require preliminary compilation
239245
- are executed very quickly

bittensor/core/subtensor_api/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def add_legacy_methods(subtensor: "SubtensorApi"):
115115
subtensor.min_allowed_weights = subtensor._subtensor.min_allowed_weights
116116
subtensor.move_stake = subtensor._subtensor.move_stake
117117
subtensor.network = subtensor._subtensor.network
118+
subtensor.neurons = subtensor._subtensor.neurons
118119
subtensor.neuron_for_uid = subtensor._subtensor.neuron_for_uid
119120
subtensor.neurons_lite = subtensor._subtensor.neurons_lite
120121
subtensor.query_constant = subtensor._subtensor.query_constant

tests/e2e_tests/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import pytest
1212
from async_substrate_interface import SubstrateInterface
1313

14-
from bittensor.core.async_subtensor import AsyncSubtensor
15-
from bittensor.core.subtensor import Subtensor
14+
from bittensor.core.subtensor_api import SubtensorApi
1615
from bittensor.utils.btlogging import logging
1716
from tests.e2e_tests.utils.e2e_test_utils import (
1817
Templates,
@@ -258,12 +257,14 @@ def templates():
258257

259258
@pytest.fixture
260259
def subtensor(local_chain):
261-
return Subtensor(network="ws://localhost:9944")
260+
return SubtensorApi(network="ws://localhost:9944", legacy_methods=True)
262261

263262

264263
@pytest.fixture
265264
def async_subtensor(local_chain):
266-
return AsyncSubtensor(network="ws://localhost:9944")
265+
return SubtensorApi(
266+
network="ws://localhost:9944", legacy_methods=True, async_subtensor=True
267+
)
267268

268269

269270
@pytest.fixture

0 commit comments

Comments
 (0)