Skip to content

Commit

Permalink
autopep8 everything
Browse files Browse the repository at this point in the history
  • Loading branch information
lsankar4033 committed Aug 19, 2020
1 parent 5261442 commit ca95473
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from lib.instance_configs import DEFAULT_INSTANCE_CONFIG
from lib.types import Fixture


def extract_fixtures(clients_to_test=SUPPORTED_CLIENTS) -> List[Fixture]:
fixtures = []
for client in SUPPORTED_CLIENTS:
Expand All @@ -24,6 +25,7 @@ def extract_fixtures(clients_to_test=SUPPORTED_CLIENTS) -> List[Fixture]:

return fixtures


def setup_fixture(fixture: Fixture):
for instance in fixture.instances:
start_instance(instance)
Expand Down
2 changes: 1 addition & 1 deletion lib/instance_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sclients import ENR

DEFAULT_BEACON_STATE_PATH = 'ssz/default.ssz'
DEFAULT_ENR = {
DEFAULT_ENR = {
'enr': 'enr:-LK4QJCIZoViytOOmAzAbdOJODwQ36PhjXwvXlTFTloTzpawVpvPRmtrM6UZdPmOGck5yPZ9AbgmwyZnE3jm4jX0Yx0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpBGMkSJAAAAAf__________gmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQOnBq2PcxFfkFACZvJz91cd-UKaTPtLv7zYJSJyAtq60YN0Y3CCIyiDdWRwgiMp',
'enr_teku': 'enr:-KG4QF9w4w5DORl2-AtVaqK6n-VF3e-2p5fm4uqDLwlR8cQ4MVk2yJ68YkEUTASbbJJ123CKYDDY1KdfBWOuVrmsZtUChGV0aDKQGK5MywAAAAH__________4JpZIJ2NIJpcIR_AAABiXNlY3AyNTZrMaEDpwatj3MRX5BQAmbyc_dXHflCmkz7S7-82CUicgLautGDdGNwgiMog3VkcIIjKA',
'private_key': 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
Expand Down
1 change: 1 addition & 0 deletions lib/logging_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

LOGGING_TESTS_DIR = 'logging_tests'


def all_logging_test_files():
tests = []
for root, dirs, files in os.walk(LOGGING_TESTS_DIR):
Expand Down
6 changes: 6 additions & 0 deletions lib/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

TESTS_DIR = 'tests'


def all_test_files():
tests = []
for root, dirs, files in os.walk(TESTS_DIR):
Expand All @@ -18,16 +19,19 @@ def all_test_files():

return tests


def file_to_module(script):
return script.replace('/', '.')[0:-3]


def return_code_to_status(return_code):
if return_code == 0:
return color('\u2713', fg='green')

else:
return color('\u2717', fg='red')


def run_module(module_str, args):
module = importlib.import_module(module_str)

Expand All @@ -39,9 +43,11 @@ def run_module(module_str, args):

return (return_code, logs)


def file_matches_filter(file, file_filter):
return file_filter is None or file == file_filter


def run_test_files(fixture_name, files, args):
print(fixture_name)

Expand Down
7 changes: 5 additions & 2 deletions steth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from lib.runner import run_test_files, all_test_files, file_matches_filter
from lib.logging_tests import all_logging_test_files


def run_test_cmd(args):
clients = SUPPORTED_CLIENTS if args.client is None else [args.client]

Expand Down Expand Up @@ -41,13 +42,14 @@ def run_logging_test(args):

failed = False
for client in SUPPORTED_CLIENTS:
return_code= run_test_files(client, test_files, {})
return_code = run_test_files(client, test_files, {})
if return_code != 0:
failed = True

if failed:
exit(1)


if __name__ == '__main__':
steth = argparse.ArgumentParser(description='Stethoscope tool for running multi-client Eth2 scenarios')
steth_sub = steth.add_subparsers()
Expand All @@ -58,7 +60,8 @@ def run_logging_test(args):
test.add_argument('-o', '--only', help='run specific tests by name')
test.set_defaults(func=run_test_cmd)

test = steth_sub.add_parser('logging_test', help='Display example logs from ./steth.py test. Useful for testing CI integration')
test = steth_sub.add_parser(
'logging_test', help='Display example logs from ./steth.py test. Useful for testing CI integration')
test.set_defaults(func=run_logging_test)

args = steth.parse_args()
Expand Down
1 change: 1 addition & 0 deletions tests/reqresp/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from ..utils import parse_chunk_response, with_rumor


class Metadata(Container):
seq_number: uint64
attnets: Bitvector[64]
Expand Down
3 changes: 3 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from eth2spec.utils.ssz.ssz_typing import Container
from pyrum import SubprocessConn, Rumor


def with_rumor(async_run_fn):
async def wrapped_run_fn(args):
async with SubprocessConn(cmd='./bin/rumor bare --level=trace') as conn:
Expand All @@ -18,12 +19,14 @@ async def wrapped_run_fn(args):

return wrapped_run_fn


def parse_chunk_response(resp):
if 'data' not in resp:
return (None, [f"request error: 'data' field not in response"])

return (resp['data'], [])


def enr_to_fork_digest(enr):
eth2 = enr.eth2
eth2 = eth2[2:] if eth2.startswith('0x') else eth2
Expand Down

0 comments on commit ca95473

Please sign in to comment.