Skip to content

Commit

Permalink
Merge pull request #33 from digitronik/string_formatting
Browse files Browse the repository at this point in the history
removed py2 :D moved to f-string
  • Loading branch information
digitronik authored Jan 1, 2020
2 parents fd93430 + 68c872d commit d49e179
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_checks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: miqsel

on: [push, pull_request]
on: push

jobs:
pre-commit:
Expand Down
4 changes: 2 additions & 2 deletions miqsel/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def browser(browser):
env = LocalEnv()

if browser:
click.echo("Browser set to {}".format(browser))
click.echo(f"Browser set to {browser}")
env.browser = browser
else:
click.echo(env.browser)
Expand All @@ -156,7 +156,7 @@ def appliance(app):
env = LocalEnv()

if app:
click.echo("Appliance set to {}".format(app))
click.echo(f"Appliance set to {app}")
env.appliance = app
else:
click.echo(env.appliance)
10 changes: 2 additions & 8 deletions miqsel/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def executor(self):
"""

return (
"http://{host}:{port}/wd/hub".format(
host=self.hostname, port=self.cfg["container"]["server_port"]
)
f"http://{self.hostname}:{self.cfg['container']['server_port']}/wd/hub"
if self.hostname
else None
)
Expand All @@ -59,11 +57,7 @@ def vnc(self):
:return: If container running return vnc url else None
"""

return (
"{host}:{port}".format(host=self.hostname, port=self.cfg["container"]["vnc_port"])
if self.hostname
else None
)
return f"{self.hostname}:{self.cfg['container']['vnc_port']}" if self.hostname else None

def start(self, **kwargs):
"""Start selenium container"""
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def config():
if not os.path.isdir("conf"):
os.mkdir("conf")
proc = Popen(["miqsel", "config"], stdin=PIPE, stdout=PIPE)
input = str.encode("{}\n\n\n\n\n".format(os.getcwd()))
input = str.encode(f"{os.getcwd()}\n\n\n\n\n")
proc.communicate(input=input)
yield
if os.path.isdir("conf"):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_configured.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def test_miqsel(state, proj_dir, ensure_stopped):
"""Check start and stop of unconfigured miqsel but run from project"""

cmd = "miqsel {}".format(state)
cmd = f"miqsel {state}"
out, _, returncode = miqsel_cmd(cmd)
assert returncode == 0
assert DATA[state]["msg"] in out
Expand Down Expand Up @@ -46,9 +46,9 @@ def test_appliance(proj_dir, ensure_stopped):

# with appliance set
app = "192.168.1.1"
out, _, returncode = miqsel_cmd("miqsel appliance -s {}".format(app))
out, _, returncode = miqsel_cmd(f"miqsel appliance -s {app}")
assert returncode == 0
assert out.strip() == "Appliance set to {}".format(app)
assert out.strip() == f"Appliance set to {app}"
out, _, returncode = miqsel_cmd("miqsel appliance")
assert out.strip() == app

Expand Down
4 changes: 2 additions & 2 deletions tests/test_unconfigured.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_miqsel_help():
def test_miqsel_status(state, ensure_stopped):
"""Check Status of unconfigured miqsel"""

cmd = "miqsel {}".format(state)
cmd = f"miqsel {state}"
miqsel_cmd(cmd)
out, _, returncode = miqsel_cmd("miqsel status")
assert returncode == 0
Expand All @@ -30,7 +30,7 @@ def test_miqsel_status(state, ensure_stopped):
@pytest.mark.parametrize("state", DATA)
def test_miqsel(state, ensure_stopped):
"""Check start and stop of unconfigured miqsel"""
cmd = "miqsel {}".format(state)
cmd = f"miqsel {state}"
out, _, returncode = miqsel_cmd(cmd)
assert returncode == 0

Expand Down

0 comments on commit d49e179

Please sign in to comment.