Skip to content

Commit

Permalink
PEP8 has gained some extra checks (#543)
Browse files Browse the repository at this point in the history
Bring the code into compliance for the extra checks.
  • Loading branch information
ajkavanagh authored Aug 11, 2022
1 parent b3aefc2 commit 4816efa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions unit_tests/test_zaza_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ async def test_async_check_if_subordinates_idle(self):
return_value=model_mock
):
idle = await model.async_check_if_subordinates_idle('app', 'app/0')
assert(idle)
assert idle

async def test_async_get_agent_status_busy(self):
model_mock = mock.MagicMock()
Expand All @@ -2399,15 +2399,15 @@ async def test_async_check_if_subordinates_idle_busy(self):
async def test_async_check_if_subordinates_idle_missing(self):
model_mock = mock.MagicMock()
status = copy.deepcopy(EXECUTING_STATUS)
del(status['units']['app/0']['subordinates'])
del status['units']['app/0']['subordinates']
model_mock.applications.__getitem__.return_value = status
with mock.patch.object(
model,
'async_get_status',
return_value=model_mock
):
idle = await model.async_check_if_subordinates_idle('app', 'app/0')
assert(idle)
assert idle

async def test_async_get_principle_sub_map(self):
model_mock = mock.MagicMock()
Expand Down
2 changes: 1 addition & 1 deletion zaza/charm_lifecycle/func_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def destroy_models(model_aliases, destroy):
def func_test_runner(keep_last_model=False, keep_all_models=False,
keep_faulty_model=False, smoke=False, dev=False,
bundles=None, force=False, test_directory=None):
"""Deploy the bundles and run the tests as defined by the charms tests.yaml.
"""Deploy bundles and run the tests as defined by the charms tests.yaml.
:param keep_last_model: Whether to destroy last model at end of run
:type keep_last_model: boolean
Expand Down
10 changes: 5 additions & 5 deletions zaza/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1552,13 +1552,13 @@ async def async_wait_for_application_states(model_name=None, states=None,
all_okay = False

# if not all states are okay, continue to the next one.
if not(all_okay):
if not all_okay:
continue

applications_left.remove(application)
logging.info("Application %s is ready.", application)

if not(applications_left):
if not applications_left:
logging.info("All applications reached approved status, "
"number of units (where relevant), and workload"
" status message checks.")
Expand Down Expand Up @@ -1843,7 +1843,7 @@ async def _check_machine_status():
interval=interval,
refresh=refresh)
equals = _status["machines"][machine].agent_status["status"] == status
return not(equals) if invert_check else equals
return not equals if invert_check else equals

async with run_in_model(model_name):
await async_block_until(_check_machine_status, timeout=timeout)
Expand Down Expand Up @@ -2334,7 +2334,7 @@ async def _unit_status():
if k.split('/')[0] == app]
g = (s.startswith(status) for s in wl_infos)
if negate_match:
return not(any(g))
return not any(g)
else:
return all(g)

Expand Down Expand Up @@ -2455,7 +2455,7 @@ async def async_get_relation_id(application_name, remote_application_name,
if remote_interface_name is not None:
spec += ':{}'.format(remote_interface_name)
if rel.matches(spec):
return(rel.id)
return rel.id

get_relation_id = sync_wrapper(async_get_relation_id)

Expand Down

0 comments on commit 4816efa

Please sign in to comment.