A framework for Massa core dev to develop functional tests
from pathlib import Path
from massa_test_framework import ServerOpts, Server, Node
# init a Server (using your computer)
server_opts = ServerOpts(local=True)
server = Server(server_opts)
# create a Node object, use compilation from given path (assuming here it's compiled here in Sandbox mode)
node1 = Node.from_dev(server, repo=Path("~/dev/massa").expanduser())
# setup config
with node1.edit_config() as cfg:
cfg["logging"]["level"] = 3
# start node
with node1.start():
# Wait for node to be ready - aka node returns a valid last period
node1.wait_ready(20)
# Call get_status
status = node1.get_status()
print(status)
-
Create a virtualenv:
python3 -m venv venv_dev
-
Install dev requirements:
venv_dev/bin/python -m pip install -e __PATH_TO_MASSA_PROTO_PYTHON_REPO__
venv_dev/bin/python -m pip install -r requirements_dev.txt
-
Formatter black:
venv_dev/bin/black massa_test_framework
-
Typing mypy:
venv_dev/bin/mypy massa_test_framework
-
Linter ruff:
venv_dev/bin/ruff check massa_test_framework
-
Doc Sphinx:
cd doc && make html
Note:
- Use Napoleon syntax when writing docstrings: Napoleon Documentation
- For a full syntax example, refer to the Example Google Docstring.
- python3 -m venv venv_grpc
- venv_grpc/bin/python -m pip install --upgrade betterproto[compiler]==2.0.0b5
- PATH=$PATH:venv_grpc/bin/ protoc -I$HOME/dev/massa-proto/proto/commons/ -I$HOME/dev/massa-proto/proto/apis/massa/api/v1/ -I$HOME/dev/massa-proto/proto/third_party/ --python_betterproto_out=massa $HOME/dev/massa-proto/proto/apis/massa/api/v1/api.proto