Skip to content

Commit

Permalink
tests/pytests: ruff linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alesmrazek committed Oct 15, 2024
1 parent 46dddac commit a61d2e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
15 changes: 7 additions & 8 deletions tests/pytests/kresd.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create_file_from_template(template_path, dest, data):


class Kresd(ContextDecorator):
def __init__(
def __init__( # noqa: PLR0913
self, workdir, port=None, tls_port=None, ip=None, ip6=None, certname=None,
verbose=True, hints=None, forward=None, policy_test_pass=False, rr=False,
valgrind=False):
Expand Down Expand Up @@ -237,13 +237,12 @@ def partial_log(self):
for line in log:
if past_startup:
partial_log += line
else: # find real start of test log (after initial alive-pings)
if not past_startup_msgid:
if re.match(KRESD_LOG_STARTUP_MSGID, line) is not None:
past_startup_msgid = True
else:
if re.match(KRESD_LOG_IO_CLOSE, line) is not None:
past_startup = True
# find real start of test log (after initial alive-pings)
elif not past_startup_msgid:
if re.match(KRESD_LOG_STARTUP_MSGID, line) is not None:
past_startup_msgid = True
elif re.match(KRESD_LOG_IO_CLOSE, line) is not None:
past_startup = True
return partial_log


Expand Down
8 changes: 4 additions & 4 deletions tests/pytests/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __exit__(self, exc_type, exc_value, traceback):
class TLSProxy(Proxy):
EXECUTABLE = 'tlsproxy'

def __init__(
def __init__( # noqa: PLR0913
self,
local_ip: str = '127.0.0.1',
local_port: Optional[int] = None,
Expand Down Expand Up @@ -130,9 +130,9 @@ def kresd_tls_client(
kresd_fwd_target_kwargs: Optional[Dict[Any, Any]] = None
) -> Kresd:
"""kresd_tls_client --(tls)--> tlsproxy --(tcp)--> kresd_fwd_target"""
ALLOWED_IPS = {'127.0.0.1', '::1'}
assert proxy.local_ip in ALLOWED_IPS, "only localhost IPs supported for proxy"
assert proxy.upstream_ip in ALLOWED_IPS, "only localhost IPs are supported for proxy"
allowed_ips = {'127.0.0.1', '::1'}
assert proxy.local_ip in allowed_ips, "only localhost IPs supported for proxy"
assert proxy.upstream_ip in allowed_ips, "only localhost IPs are supported for proxy"

if kresd_tls_client_kwargs is None:
kresd_tls_client_kwargs = {}
Expand Down

0 comments on commit a61d2e9

Please sign in to comment.