Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelo-gonzalez committed Apr 4, 2024
1 parent 384251d commit 0d329a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 3 additions & 9 deletions pytest/tests/mocknet/helpers/neard_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,7 @@ def do_reset(self, backup_id=None):
code=-32600,
message='Cannot reset data dir as test state is not ready')

try:
backups = self.data['backups']
except KeyError:
backups = {}
backups = self.data.get('backups', {})
if backup_id is not None and backup_id != 'start' and backup_id not in backups:
raise jsonrpc.exceptions.JSONRPCDispatchException(
code=-32600, message=f'backup ID {backup_id} not known')
Expand Down Expand Up @@ -748,11 +745,8 @@ def set_state(self, state, data=None):
self.data['state_data'] = data

def making_backup(self, backup_id, description=None):
self.set_state(TestState.MAKING_BACKUP,
data={
'backup_id': backup_id,
'description': description
})
backup_data = {'backup_id': backup_id, 'description': description}
self.set_state(TestState.MAKING_BACKUP, data=backup_data)

def network_init(self):
# wait til we get a network_init RPC
Expand Down
10 changes: 5 additions & 5 deletions pytest/tests/mocknet/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ def make_backup_cmd(args, traffic_generator, nodes):
args.backup_id = sys.stdin.readline().strip()
if re.match(r'^[0-9a-zA-Z.][0-9a-zA-Z_\-.]+$', args.backup_id) is None:
sys.exit('invalid backup ID')
if args.description is None:
print('please enter a description (enter nothing to skip):')
description = sys.stdin.readline().strip()
if len(description) > 0:
args.description = description
if args.description is None:
print('please enter a description (enter nothing to skip):')
description = sys.stdin.readline().strip()
if len(description) > 0:
args.description = description

all_nodes = nodes + [traffic_generator]
pmap(
Expand Down

0 comments on commit 0d329a1

Please sign in to comment.