Skip to content

Commit

Permalink
Flake 8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pieqq committed Oct 20, 2023
1 parent 8ab03e8 commit d78eed4
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions providers/base/bin/snap_update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ def wait_for_snap_change(self, change_id, type, timeout=300):
elif result == "Error":
tasks = self.snapd.tasks(str(change_id))
for task in tasks:
logger.error("%s | %s | %s",
task["id"],
task["status"],
task["summary"]
logger.error(
"%s | %s | %s",
task["id"],
task["status"],
task["summary"],
)
if task.get("log"):
for log in task["log"]:
logger.error("\t %s", log)
raise SystemExit("Error during snap {} {}.".format(
self.name, type)
raise SystemExit(
"Error during snap {} {}.".format(self.name, type)
)


current_time = time.time()
if current_time - start_time >= timeout:
raise SystemExit(
Expand All @@ -222,15 +222,18 @@ def wait_for_snap_change(self, change_id, type, timeout=300):
)
logger.info("Waiting for %s snap %s to be done...",
self.name,
type)
type
)
logger.info("Trying again in 10 seconds...")
time.sleep(10)

def verify(self, type, timeout=300):
logger.info("Beginning verify...")
if type not in ("refresh", "revert"):
msg = ("'{}' verification unknown. Can be either 'refresh' "
"or 'revert'.").format(type)
msg = (
"'{}' verification unknown. Can be either 'refresh' "
"or 'revert'."
).format(type)
raise SystemExit(msg)
data = load_change_info(self.path)
id = data["change_id"]
Expand All @@ -243,10 +246,11 @@ def verify(self, type, timeout=300):
else:
tested_rev = data["original_revision"]
if current_rev != tested_rev:
msg = ("Current revision ({}) is different from expected revision "
"({})").format(current_rev, tested_rev)
raise SystemExit(
)
msg = (
"Current revision ({}) is different from expected revision "
"({})"
).format(current_rev, tested_rev)
raise SystemExit()
else:
logger.info(
"PASS: current revision (%s) matches the expected revision",
Expand Down

0 comments on commit d78eed4

Please sign in to comment.