From 4eb691e89c3e324d10d112510bb76f352d655b64 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 25 Jul 2026 13:35:51 -0700 Subject: [PATCH] tests: change whitespace and comments in Python test code * remove an unneeded ruff warning disable * remove coding: utf-8 from Python code; PEP 3120 makes UTF-8 the default encoding * remove unusable shebang lines from Python code * remove empty print strings * disable warnings when file objects are stored; these instances can't be handled with context managers * use more consistent whitespace in Python code, fixing flake8 warnings * set the executable bit on scorecard.py, making it easier to run These fix ruff rules EXE001, FURB105, UP009, SIM115. --- tests/dictserver.py | 1 - tests/ech_combos.py | 9 ++-- tests/http/scorecard.py | 23 +++++----- tests/http/test_01_basic.py | 2 - tests/http/test_02_download.py | 10 ++-- tests/http/test_03_goaway.py | 2 - tests/http/test_04_stuttered.py | 2 - tests/http/test_05_errors.py | 2 - tests/http/test_06_eyeballs.py | 4 +- tests/http/test_07_upload.py | 12 ++--- tests/http/test_08_caddy.py | 2 - tests/http/test_09_push.py | 2 - tests/http/test_10_proxy.py | 2 - tests/http/test_11_unix.py | 2 - tests/http/test_12_reuse.py | 2 - tests/http/test_13_proxy_auth.py | 6 +-- tests/http/test_14_auth.py | 6 +-- tests/http/test_15_tracing.py | 10 ++-- tests/http/test_16_info.py | 2 - tests/http/test_17_ssl_use.py | 6 +-- tests/http/test_18_methods.py | 2 - tests/http/test_19_shutdown.py | 2 - tests/http/test_20_websockets.py | 6 +-- tests/http/test_21_resolve.py | 16 +++---- tests/http/test_22_httpsrr.py | 2 - tests/http/test_30_vsftpd.py | 2 - tests/http/test_31_vsftpds.py | 6 +-- tests/http/test_32_ftps_vsftpd.py | 6 +-- tests/http/test_40_socks.py | 2 - tests/http/test_50_scp.py | 2 - tests/http/test_51_sftp.py | 2 - tests/http/test_60_h3_proxy.py | 2 - tests/http/testenv/__init__.py | 4 +- tests/http/testenv/caddy.py | 4 +- tests/http/testenv/certs.py | 2 - tests/http/testenv/client.py | 4 +- tests/http/testenv/curl.py | 61 +++++++++++-------------- tests/http/testenv/dante.py | 8 ++-- tests/http/testenv/dnsd.py | 4 +- tests/http/testenv/env.py | 12 ++--- tests/http/testenv/h2o.py | 4 +- tests/http/testenv/httpd.py | 7 +-- tests/http/testenv/nghttpx.py | 6 +-- tests/http/testenv/ports.py | 2 - tests/http/testenv/sshd.py | 4 +- tests/http/testenv/vsftpd.py | 4 +- tests/http/testenv/ws_4frames_server.py | 1 - tests/http/testenv/ws_echo_server.py | 1 - tests/negtelnetserver.py | 1 - tests/smbserver.py | 17 +++---- tests/util.py | 1 - 51 files changed, 105 insertions(+), 199 deletions(-) mode change 100644 => 100755 tests/http/scorecard.py diff --git a/tests/dictserver.py b/tests/dictserver.py index 4419e11582..ea9f586c44 100755 --- a/tests/dictserver.py +++ b/tests/dictserver.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/ech_combos.py b/tests/ech_combos.py index 8b15eff41f..90db92ca91 100755 --- a/tests/ech_combos.py +++ b/tests/ech_combos.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -45,12 +44,12 @@ def CombinationRepetitionUtil(chosen, arr, badarr, index, if chosen[j] in badarr: res = 0 j = j - 1 - print("cli_test $turl 1", res, end = " ") + print("cli_test $turl 1", res, end=" ") # print combination but eliminating any runs of # two identical params for j in range(r): if j != 0 and chosen[j] != chosen[j-1]: - print(chosen[j], end = " ") + print(chosen[j], end=" ") print() return @@ -89,8 +88,8 @@ def CombinationRepetition(arr, badarr, n, r): # Driver code -badarr = [ '--ech grease', '--ech false', '--ech ecl:$badecl', '--ech pn:$badpn' ] -goodarr = [ '--ech hard', '--ech true', '--ech ecl:$goodecl', '--ech pn:$goodpn' ] +badarr = ['--ech grease', '--ech false', '--ech ecl:$badecl', '--ech pn:$badpn'] +goodarr = ['--ech hard', '--ech true', '--ech ecl:$goodecl', '--ech pn:$goodpn'] arr = badarr + goodarr r = 8 n = len(arr) - 1 diff --git a/tests/http/scorecard.py b/tests/http/scorecard.py old mode 100644 new mode 100755 index 95e092672e..1550ccb99e --- a/tests/http/scorecard.py +++ b/tests/http/scorecard.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -211,7 +210,7 @@ class Card: print(f' {col:>{colw[idx]}} {"[cpu/rss]":<{statw}}', end='') else: print(f' {col:>{colw[idx]}}', end='') - print('') + print() for row in rows: for idx, cell in enumerate(row): print(f' {cell["sval"]:>{colw[idx]}}', end='') @@ -224,7 +223,7 @@ class Card: print(f' {s:<{statw}}', end='') if 'errors' in cell: errors.extend(cell['errors']) - print('') + print() if len(errors): print(f'Errors: {errors}') @@ -647,13 +646,15 @@ class ScoreRunner: rows = [] mparallel = meta['request_parallels'] cols.extend([f'{mp} max' for mp in mparallel]) - row = [{ - 'val': fsize, - 'sval': Card.fmt_size(fsize) - },{ - 'val': count, - 'sval': f'{count}', - }] + row = [ + { + 'val': fsize, + 'sval': Card.fmt_size(fsize) + }, { + 'val': count, + 'sval': f'{count}', + } + ] self.info('requests, max parallel...') row.extend([self.do_requests(url=url, count=count, max_parallel=mp, nsamples=meta["samples"]) @@ -992,7 +993,7 @@ def main(): parser.add_argument("--remote", action='store', type=str, default=None, help="score against the remote server at :") parser.add_argument("--flame", action='store_true', - default = False, help="produce a flame graph on curl") + default=False, help="produce a flame graph on curl") parser.add_argument("--limit-rate", action='store', type=str, default=None, help="use curl's --limit-rate") parser.add_argument("--http-plain", action='store_true', diff --git a/tests/http/test_01_basic.py b/tests/http/test_01_basic.py index 86f7ad191f..24e03d19b8 100644 --- a/tests/http/test_01_basic.py +++ b/tests/http/test_01_basic.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_02_download.py b/tests/http/test_02_download.py index 413d518a6e..437db80ae4 100644 --- a/tests/http/test_02_download.py +++ b/tests/http/test_02_download.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -141,8 +139,8 @@ class TestDownload: urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]' r = curl.http_download(urls=[urln], alpn_proto=proto, with_stats=True, extra_args=[ - '--parallel', '--parallel-max', '200' - ]) + '--parallel', '--parallel-max', '200' + ]) r.check_response(http_status=200, count=count) # should have used at most 2 connections only (test servers allow 100 req/conn) # it may be 1 on slow systems where request are answered faster than @@ -157,8 +155,8 @@ class TestDownload: urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]' r = curl.http_download(urls=[urln], alpn_proto=proto, with_stats=True, extra_args=[ - '--parallel' - ]) + '--parallel' + ]) r.check_response(count=count, http_status=200) # http/1.1 should have used count connections assert r.total_connects == count, "http/1.1 should use this many connections" diff --git a/tests/http/test_03_goaway.py b/tests/http/test_03_goaway.py index 4c57bf2715..36febdbd18 100644 --- a/tests/http/test_03_goaway.py +++ b/tests/http/test_03_goaway.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_04_stuttered.py b/tests/http/test_04_stuttered.py index 1c578e2e9e..3ad25d93ae 100644 --- a/tests/http/test_04_stuttered.py +++ b/tests/http/test_04_stuttered.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_05_errors.py b/tests/http/test_05_errors.py index 60a9aaa2e4..768416eea3 100644 --- a/tests/http/test_05_errors.py +++ b/tests/http/test_05_errors.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_06_eyeballs.py b/tests/http/test_06_eyeballs.py index 1dc3726f48..b72a89d75e 100644 --- a/tests/http/test_06_eyeballs.py +++ b/tests/http/test_06_eyeballs.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -129,7 +127,7 @@ class TestEyeballs: assert r.stats[0]['time_connect'] == 0 # no one connected # check that we indeed started attempts on all 3 addresses tcp_attempts = [line for line in r.trace_lines - if re.match(r'.*Trying \[100::[123]]:443', line)] + if re.match(r'.*Trying \[100::[123]]:443', line)] assert len(tcp_attempts) == 3, f'fond: {"".join(tcp_attempts)}\n{r.dump_logs()}' # if the 0100::/64 really goes into the void, we should see 2 HAPPY_EYEBALLS # timeouts being set here diff --git a/tests/http/test_07_upload.py b/tests/http/test_07_upload.py index 6cb4d943e1..7ad396d73c 100644 --- a/tests/http/test_07_upload.py +++ b/tests/http/test_07_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -549,7 +547,7 @@ class TestUpload: ]) r.check_exit_code(0) results = [int(m.group(1)) for line in r.trace_lines - if (m := re.match(r'.* FINISHED, result=(\d+), response=(\d+)', line))] + if (m := re.match(r'.* FINISHED, result=(\d+), response=(\d+)', line))] httpcodes = [int(m.group(2)) for line in r.trace_lines if (m := re.match(r'.* FINISHED, result=(\d+), response=(\d+)', line))] if httpcode == 308: @@ -568,8 +566,8 @@ class TestUpload: url = f'https://{env.authority_for(env.domain1, proto)}/curltest/put?id=[0-0]' r = curl.http_put(urls=[url], fdata=fdata, alpn_proto=proto, with_headers=True, extra_args=[ - '--limit-rate', f'{speed_limit}' - ]) + '--limit-rate', f'{speed_limit}' + ]) r.check_response(count=count, http_status=200) assert r.responses[0]['header']['received-length'] == f'{up_len}', f'{r.responses[0]}' up_speed = r.stats[0]['speed_upload'] @@ -585,8 +583,8 @@ class TestUpload: url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' r = curl.http_upload(urls=[url], data=f'@{fdata}', alpn_proto=proto, with_headers=True, extra_args=[ - '--limit-rate', f'{speed_limit}' - ]) + '--limit-rate', f'{speed_limit}' + ]) r.check_response(count=count, http_status=200) up_speed = r.stats[0]['speed_upload'] assert up_speed <= (speed_limit * 1.1), f'{r.stats[0]}' diff --git a/tests/http/test_08_caddy.py b/tests/http/test_08_caddy.py index 23cea4582a..70413a84d5 100644 --- a/tests/http/test_08_caddy.py +++ b/tests/http/test_08_caddy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_09_push.py b/tests/http/test_09_push.py index 386289b39e..7fb37b679d 100644 --- a/tests/http/test_09_push.py +++ b/tests/http/test_09_push.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_10_proxy.py b/tests/http/test_10_proxy.py index 7ef77465bc..bd07841a68 100644 --- a/tests/http/test_10_proxy.py +++ b/tests/http/test_10_proxy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_11_unix.py b/tests/http/test_11_unix.py index b4e5ac7974..6ba500e1ce 100644 --- a/tests/http/test_11_unix.py +++ b/tests/http/test_11_unix.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_12_reuse.py b/tests/http/test_12_reuse.py index d4e2f70861..b7a2513ef0 100644 --- a/tests/http/test_12_reuse.py +++ b/tests/http/test_12_reuse.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_13_proxy_auth.py b/tests/http/test_13_proxy_auth.py index 50e4596057..4e5d45e918 100644 --- a/tests/http/test_13_proxy_auth.py +++ b/tests/http/test_13_proxy_auth.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -175,9 +173,9 @@ class TestProxyAuth: url2 = f'http://localhost:{env.http_port}/data.json?2' url3 = f'http://localhost:{env.http_port}/data.json?3' xargs1 = curl.get_proxy_args(proxys=False, tunnel=True) - xargs1.extend(['--proxy-user', 'proxy:proxy']) # good auth + xargs1.extend(['--proxy-user', 'proxy:proxy']) # good auth xargs2 = curl.get_proxy_args(proxys=False, tunnel=True) - xargs2.extend(['--proxy-user', 'ungood:ungood']) # bad auth + xargs2.extend(['--proxy-user', 'ungood:ungood']) # bad auth xargs3 = curl.get_proxy_args(proxys=False, tunnel=True) # no auth r = curl.http_download(urls=[url1, url2, url3], alpn_proto='http/1.1', with_stats=True, diff --git a/tests/http/test_14_auth.py b/tests/http/test_14_auth.py index ca808e0077..268ebae514 100644 --- a/tests/http/test_14_auth.py +++ b/tests/http/test_14_auth.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -64,7 +62,7 @@ class TestAuth: def test_14_03_digest_put_auth(self, env: Env, httpd, nghttpx, proto): if not env.curl_has_feature('digest'): pytest.skip("curl built without digest") - data='0123456789' + data = '0123456789' curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/restricted/digest/data.json' r = curl.http_upload(urls=[url], data=data, alpn_proto=proto, extra_args=[ @@ -77,7 +75,7 @@ class TestAuth: def test_14_04_digest_large_pw(self, env: Env, httpd, nghttpx, proto): if not env.curl_has_feature('digest'): pytest.skip("curl built without digest") - data='0123456789' + data = '0123456789' password = 'x' * 65535 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/restricted/digest/data.json' diff --git a/tests/http/test_15_tracing.py b/tests/http/test_15_tracing.py index d1bcc22273..d2e987f867 100644 --- a/tests/http/test_15_tracing.py +++ b/tests/http/test_15_tracing.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -55,7 +53,7 @@ class TestTracing: '-v', '--trace-config', 'ids' ]) r.check_response(http_status=200) - for line in r.trace_lines: + for line in r.trace_lines: m = re.match(r'^\[0-[0x]] .+', line) if m is None: assert False, f'no match: {line}' @@ -68,7 +66,7 @@ class TestTracing: '-v', '--trace-config', 'ids,time' ]) r.check_response(http_status=200) - for line in r.trace_lines: + for line in r.trace_lines: m = re.match(r'^([0-9:.]+) \[0-[0x]] .+', line) if m is None: assert False, f'no match: {line}' @@ -84,7 +82,7 @@ class TestTracing: ]) r.check_response(http_status=200) found_tcp = False - for line in r.trace_lines: + for line in r.trace_lines: m = re.match(r'^([0-9:.]+) \[0-[0x]] .+', line) if m is None: assert False, f'no match: {line}' @@ -102,7 +100,7 @@ class TestTracing: ]) r.check_response(http_status=200) found_tcp = False - for line in r.trace_lines: + for line in r.trace_lines: m = re.match(r'^\[0-[0x]] .+', line) if m is None: assert False, f'no match: {line}' diff --git a/tests/http/test_16_info.py b/tests/http/test_16_info.py index 977342eb55..0d184931e2 100644 --- a/tests/http/test_16_info.py +++ b/tests/http/test_16_info.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_17_ssl_use.py b/tests/http/test_17_ssl_use.py index 4179925f42..c5b5e144f3 100644 --- a/tests/http/test_17_ssl_use.py +++ b/tests/http/test_17_ssl_use.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -222,7 +220,7 @@ class TestSSLUse: ['AES256ish', ['ECDHE-ECDSA-AES256-GCM-SHA384', 'ECDHE-RSA-AES256-GCM-SHA384'], False], ['CHACHA20ish', ['ECDHE-ECDSA-CHACHA20-POLY1305', 'ECDHE-RSA-CHACHA20-POLY1305'], True], ['AES256ish+CHACHA20ish', ['ECDHE-ECDSA-AES256-GCM-SHA384', 'ECDHE-RSA-AES256-GCM-SHA384', - 'ECDHE-ECDSA-CHACHA20-POLY1305', 'ECDHE-RSA-CHACHA20-POLY1305'], True], + 'ECDHE-ECDSA-CHACHA20-POLY1305', 'ECDHE-RSA-CHACHA20-POLY1305'], True], ] ret = [] for tls_id, tls_proto in { @@ -521,7 +519,7 @@ class TestSSLUse: pytest.param("-MAC-ALL:+AEAD", "TLSv1.3", ['TLS_CHACHA20_POLY1305_SHA256'], True, id='TLSv1.3-MAC-only-AEAD'), pytest.param("-GROUP-ALL:+GROUP-X25519", "TLSv1.3", ['TLS_CHACHA20_POLY1305_SHA256'], True, id='TLSv1.3-group-only-X25519'), pytest.param("-GROUP-ALL:+GROUP-SECP192R1", "", [], False, id='group-only-SECP192R1'), - ]) + ]) def test_17_18_gnutls_priority(self, env: Env, httpd, configures_httpd, priority, tls_proto, ciphers, success): # to test setting cipher suites, the AES 256 ciphers are disabled in the test server httpd.set_extra_config('base', [ diff --git a/tests/http/test_18_methods.py b/tests/http/test_18_methods.py index faa31a638e..452b422c6b 100644 --- a/tests/http/test_18_methods.py +++ b/tests/http/test_18_methods.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_19_shutdown.py b/tests/http/test_19_shutdown.py index 4ac447d758..388d3955da 100644 --- a/tests/http/test_19_shutdown.py +++ b/tests/http/test_19_shutdown.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_20_websockets.py b/tests/http/test_20_websockets.py index 5ee8b5e6a9..0d1bdd9ed3 100644 --- a/tests/http/test_20_websockets.py +++ b/tests/http/test_20_websockets.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -95,7 +93,7 @@ class WsServer: self.wsproc = None return False - self.cerr = open(self.err_file, 'w') + self.cerr = open(self.err_file, 'w') # noqa: SIM115 port_spec = { self.name: socket.SOCK_STREAM } @@ -248,7 +246,7 @@ class TestWebsockets: r = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True, extra_args=xargs) # The CONNECT through the proxy fails as it does not allow it - r.check_exit_code(7) # CURLE_COULDNT_CONNECT + r.check_exit_code(7) # CURLE_COULDNT_CONNECT assert r.stats[0]['http_connect'] == 403, f'{r}' def test_20_11_crazy_pings(self, env: Env): diff --git a/tests/http/test_21_resolve.py b/tests/http/test_21_resolve.py index 940952400a..a287cfdf8f 100644 --- a/tests/http/test_21_resolve.py +++ b/tests/http/test_21_resolve.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -70,7 +68,7 @@ class TestResolve: run_env = os.environ.copy() run_env['CURL_DBG_RESOLV_FAIL_DELAY'] = f'{delay_ms}' curl = CurlClient(env=env, run_env=run_env, force_resolv=False) - urls = [ f'https://test-{i}.http.curl.invalid/' for i in range(count)] + urls = [f'https://test-{i}.http.curl.invalid/' for i in range(count)] r = curl.http_download(urls=urls, with_stats=True) r.check_exit_code(6) r.check_stats(count=count, http_status=0, exitcode=6) @@ -82,7 +80,7 @@ class TestResolve: run_env = os.environ.copy() run_env['CURL_DBG_RESOLV_FAIL_DELAY'] = f'{delay_ms}' curl = CurlClient(env=env, run_env=run_env, force_resolv=False) - urls = [ f'https://test-{i}.http.curl.invalid/' for i in range(count)] + urls = [f'https://test-{i}.http.curl.invalid/' for i in range(count)] r = curl.http_download(urls=urls, with_stats=True, extra_args=[ '--parallel' ]) @@ -118,7 +116,7 @@ class TestResolve: run_env['CURL_DBG_RESOLV_FAIL_DELAY'] = f'{delay_ms}' run_env['CURL_DBG_RESOLV_MAX_THREADS'] = '1' curl = CurlClient(env=env, run_env=run_env, force_resolv=False) - urls = [ f'https://test-{i}.http.curl.invalid/' for i in range(count)] + urls = [f'https://test-{i}.http.curl.invalid/' for i in range(count)] r = curl.http_download(urls=urls, with_stats=True, extra_args=[ '--parallel', '-6' ]) @@ -301,11 +299,13 @@ class TestResolve: ]) # should fail with CURLE_OPERATION_TIMEOUT or COULDNT_CONNECT assert r.exit_code in (7, 28), f'{r.dump_logs()}' - af_unspec_resolves = [line for line in r.trace_lines if - re.match(r'.* \[DNS] re-queueing query .+ for AF_UNSPEC resolve', line)] + af_unspec_resolves = [ + line for line in r.trace_lines + if re.match(r'.* \[DNS] re-queueing query .+ for AF_UNSPEC resolve', line) + ] assert len(af_unspec_resolves) == 1, f'{r.dump_logs()}' aaaa_resolves = [line for line in r.trace_lines if - re.match(r'.* \* IPv6: fe80::1', line)] + re.match(r'.* \* IPv6: fe80::1', line)] assert len(aaaa_resolves) == 1, f'{r.dump_logs()}' def _clean_files(self, files): diff --git a/tests/http/test_22_httpsrr.py b/tests/http/test_22_httpsrr.py index 0b95472aa7..6ae5d0c728 100644 --- a/tests/http/test_22_httpsrr.py +++ b/tests/http/test_22_httpsrr.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_30_vsftpd.py b/tests/http/test_30_vsftpd.py index 6627be2613..860c38d5d3 100644 --- a/tests/http/test_30_vsftpd.py +++ b/tests/http/test_30_vsftpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_31_vsftpds.py b/tests/http/test_31_vsftpds.py index 1d8a897fbd..debb8c9b5b 100644 --- a/tests/http/test_31_vsftpds.py +++ b/tests/http/test_31_vsftpds.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -109,7 +107,7 @@ class TestVsFTPD: ['data-1k', 10, True], ['data-1m', 5, True], ['data-1m', 5, False], - ['data-10m', 2,True] + ['data-10m', 2, True] ]) def test_31_03_download_10_serial(self, env: Env, vsftpds: VsFTPD, docname, count, secure): curl = CurlClient(env=env) @@ -128,7 +126,7 @@ class TestVsFTPD: ['data-1k', 10, True], ['data-1m', 5, True], ['data-1m', 5, False], - ['data-10m', 2,True] + ['data-10m', 2, True] ]) def test_31_04_download_10_parallel(self, env: Env, vsftpds: VsFTPD, docname, count, secure): curl = CurlClient(env=env) diff --git a/tests/http/test_32_ftps_vsftpd.py b/tests/http/test_32_ftps_vsftpd.py index 1e2e965292..6db7fb1eaa 100644 --- a/tests/http/test_32_ftps_vsftpd.py +++ b/tests/http/test_32_ftps_vsftpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -109,7 +107,7 @@ class TestFtpsVsFTPD: ['data-1k', 10, True], ['data-1m', 5, True], ['data-1m', 5, False], - ['data-10m', 2,True] + ['data-10m', 2, True] ]) def test_32_03_download_10_serial(self, env: Env, vsftpds: VsFTPD, docname, count, secure): curl = CurlClient(env=env) @@ -131,7 +129,7 @@ class TestFtpsVsFTPD: docname = 'data-1k' count = 2 url1 = f'ftps://{env.ftp_domain}:{vsftpds.port}/{docname}' - url2 = f'ftp://{env.ftp_domain}:{vsftpds.port}/{docname}' + url2 = f'ftp://{env.ftp_domain}:{vsftpds.port}/{docname}' r = curl.ftp_get(urls=[url1, url2], with_stats=True) r.check_stats(count=count, http_status=226) assert r.total_connects == count + 1, 'should reuse the control conn' diff --git a/tests/http/test_40_socks.py b/tests/http/test_40_socks.py index f4ae322f73..186b75e430 100644 --- a/tests/http/test_40_socks.py +++ b/tests/http/test_40_socks.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_50_scp.py b/tests/http/test_50_scp.py index 831ee5b3f8..13c36acd65 100644 --- a/tests/http/test_50_scp.py +++ b/tests/http/test_50_scp.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_51_sftp.py b/tests/http/test_51_sftp.py index acf76ef683..6caaad9d25 100644 --- a/tests/http/test_51_sftp.py +++ b/tests/http/test_51_sftp.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/test_60_h3_proxy.py b/tests/http/test_60_h3_proxy.py index 29630e5b07..650644eb0d 100644 --- a/tests/http/test_60_h3_proxy.py +++ b/tests/http/test_60_h3_proxy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- # *************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/testenv/__init__.py b/tests/http/testenv/__init__.py index d2eea486fa..834230a853 100644 --- a/tests/http/testenv/__init__.py +++ b/tests/http/testenv/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -23,7 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### -# ruff: noqa: F401, E402 +# ruff: noqa: F401 import pytest pytest.register_assert_rewrite("testenv.env", "testenv.curl", "testenv.caddy", diff --git a/tests/http/testenv/caddy.py b/tests/http/testenv/caddy.py index a6c8b58c5c..399bead7a5 100644 --- a/tests/http/testenv/caddy.py +++ b/tests/http/testenv/caddy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -113,7 +111,7 @@ class Caddy: args = [ self._caddy, 'run' ] - self._error_fd = open(self._error_log, 'a') + self._error_fd = open(self._error_log, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, cwd=self._caddy_dir, stderr=self._error_fd) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/certs.py b/tests/http/testenv/certs.py index 8c25155b24..3102e85399 100644 --- a/tests/http/testenv/certs.py +++ b/tests/http/testenv/certs.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/testenv/client.py b/tests/http/testenv/client.py index 0df19e5b42..39fd61054d 100644 --- a/tests/http/testenv/client.py +++ b/tests/http/testenv/client.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -41,7 +39,7 @@ class LocalClient: def __init__(self, name: str, env: Env, run_dir: Optional[str] = None, timeout: Optional[float] = None, - run_env: Optional[Dict[str,str]] = None): + run_env: Optional[Dict[str, str]] = None): self.name = name self.path = os.path.join(env.build_dir, 'tests/libtest/libtests') self.env = env diff --git a/tests/http/testenv/curl.py b/tests/http/testenv/curl.py index 8e187039ab..f37928471f 100644 --- a/tests/http/testenv/curl.py +++ b/tests/http/testenv/curl.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -74,7 +72,7 @@ class RunProfile: return self._duration @property - def stats(self) -> Optional[Dict[str,Any]]: + def stats(self) -> Optional[Dict[str, Any]]: return self._stats def sample(self): @@ -134,9 +132,8 @@ class PerfProfile: self._proc.terminate() self._rc = self._proc.returncode with open(self._file, 'w') as cout: - subprocess.run([ - 'sudo', 'perf', 'script' - ], stdout=cout, cwd=self._run_dir, shell=False, check=True) + subprocess.run(['sudo', 'perf', 'script'], + stdout=cout, cwd=self._run_dir, shell=False, check=True) @property def file(self): @@ -496,14 +493,14 @@ class ExecResult: for idx, x in enumerate(self.stats): assert 'remote_port' in x, f'remote_port missing\n{self.dump_stat(x)}' assert x['remote_port'] == remote_port, \ - f'status #{idx} remote_port: expected {remote_port}, '\ - f'got {x["remote_port"]}\n{self.dump_stat(x)}' + f'status #{idx} remote_port: expected {remote_port}, '\ + f'got {x["remote_port"]}\n{self.dump_stat(x)}' if remote_ip is not None: for idx, x in enumerate(self.stats): assert 'remote_ip' in x, f'remote_ip missing\n{self.dump_stat(x)}' assert x['remote_ip'] == remote_ip, \ - f'status #{idx} remote_ip: expected {remote_ip}, '\ - f'got {x["remote_ip"]}\n{self.dump_stat(x)}' + f'status #{idx} remote_ip: expected {remote_ip}, '\ + f'got {x["remote_ip"]}\n{self.dump_stat(x)}' def check_stat_positive(self, s, idx, key): assert key in s, f'stat #{idx} "{key}" missing: {s}' @@ -602,8 +599,8 @@ class ExecResult: return ''.join(lines) def xfer_trace_for(self, xfer_id) -> List[str]: - pat = re.compile(f'^[^[]* \\[{xfer_id}-.*$') - return [line for line in self._stderr if pat.match(line)] + pat = re.compile(f'^[^[]* \\[{xfer_id}-.*$') + return [line for line in self._stderr if pat.match(line)] class CurlClient: @@ -853,11 +850,11 @@ class CurlClient: with_headers=with_headers) def ftp_get(self, urls: List[str], - with_stats: bool = True, - with_profile: bool = False, - with_tcpdump: bool = False, - no_save: bool = False, - extra_args: Optional[List[str]] = None): + with_stats: bool = True, + with_profile: bool = False, + with_tcpdump: bool = False, + no_save: bool = False, + extra_args: Optional[List[str]] = None): if extra_args is None: extra_args = [] if no_save: @@ -882,11 +879,11 @@ class CurlClient: with_tcpdump=with_tcpdump) def ftp_ssl_get(self, urls: List[str], - with_stats: bool = True, - with_profile: bool = False, - with_tcpdump: bool = False, - no_save: bool = False, - extra_args: Optional[List[str]] = None): + with_stats: bool = True, + with_profile: bool = False, + with_tcpdump: bool = False, + no_save: bool = False, + extra_args: Optional[List[str]] = None): if extra_args is None: extra_args = [] extra_args.extend([ @@ -1164,7 +1161,7 @@ class CurlClient: elif insecure: args.append('--insecure') elif active_options and ("--cacert" in active_options or - "--capath" in active_options): + "--capath" in active_options): pass elif u.hostname: args.extend(["--cacert", self.env.ca.cert_file]) @@ -1246,9 +1243,8 @@ class CurlClient: stacks_collapsed = f'{perf.file}.collapsed' log.info(f'collapsing stacks into {stacks_collapsed}') with open(stacks_collapsed, 'w') as cout, open(file_err, 'w') as cerr: - subprocess.run([ - fg_collapse, perf.file - ], stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) + subprocess.run([fg_collapse, perf.file], + stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) return stacks_collapsed def _dtrace_collapse(self, dtrace: DTraceProfile, file_err): @@ -1260,9 +1256,8 @@ class CurlClient: stacks_collapsed = f'{dtrace.file}.collapsed' log.info(f'collapsing stacks into {stacks_collapsed}') with open(stacks_collapsed, 'w') as cout, open(file_err, 'a') as cerr: - subprocess.run([ - fg_collapse, dtrace.file - ], stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) + subprocess.run([fg_collapse, dtrace.file], + stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) return stacks_collapsed def _generate_flame(self, curl_args: List[str], @@ -1293,11 +1288,9 @@ class CurlClient: title = cmdline subtitle = '' with open(file_svg, 'w') as cout, open(file_err, 'a') as cerr: - subprocess.run([ - fg_gen_flame, '--colors', 'green', - '--title', title, '--subtitle', subtitle, - stacks_collapsed - ], stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) + subprocess.run([fg_gen_flame, '--colors', 'green', '--title', title, '--subtitle', + subtitle, stacks_collapsed], + stdout=cout, stderr=cerr, cwd=self._run_dir, shell=False, check=True) def mk_altsvc_file(self, name, src_alpn, src_host, src_port, dest_alpn, dest_host, dest_port): diff --git a/tests/http/testenv/dante.py b/tests/http/testenv/dante.py index b2ea4dd0cf..43b058e196 100644 --- a/tests/http/testenv/dante.py +++ b/tests/http/testenv/dante.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -128,7 +126,7 @@ class Dante: '-p', f'{self._pid_file}', '-d', '0', ] - self._error_fd = open(self._error_log, 'a') + self._error_fd = open(self._error_log, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False @@ -137,8 +135,8 @@ class Dante: def wait_live(self, timeout: timedelta): curl = CurlClient(env=self.env, run_dir=self._tmp_dir, timeout=timeout.total_seconds(), socks_args=[ - '--socks5', f'127.0.0.1:{self._port}' - ]) + '--socks5', f'127.0.0.1:{self._port}' + ]) try_until = datetime.now() + timeout while datetime.now() < try_until: r = curl.http_get(url=f'http://{self.env.domain1}:{self.env.http_port}/') diff --git a/tests/http/testenv/dnsd.py b/tests/http/testenv/dnsd.py index 8f6bb3edc8..18cfafcc38 100644 --- a/tests/http/testenv/dnsd.py +++ b/tests/http/testenv/dnsd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -128,7 +126,7 @@ class Dnsd: '--logfile', f'{self._log_file}', '--pidfile', f'{self._pid_file}', ] - self._error_fd = open(self._error_log, 'a') + self._error_fd = open(self._error_log, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/env.py b/tests/http/testenv/env.py index 5acb3ab67a..24c2276c1e 100644 --- a/tests/http/testenv/env.py +++ b/tests/http/testenv/env.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- # *************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -513,8 +511,8 @@ class Env: def curl_version_at_least(min_version) -> bool: version = Env.curl_version() return Env.CONFIG.versiontuple(min_version) <= Env.CONFIG.versiontuple( - version - ) + version + ) @staticmethod def curl_features_string() -> str: @@ -537,7 +535,7 @@ class Env: prefix = f"{libname.lower()}/" for lversion in Env.CONFIG.curl_props["lib_versions"]: if lversion.startswith(prefix): - return lversion[len(prefix) :] + return lversion[len(prefix):] return "unknown" @staticmethod @@ -914,14 +912,14 @@ class Env: fpath = os.path.join(indir, fname) s10 = "0123456789" s = round((line_length / 10) + 1) * s10 - s = s[0 : line_length - 11] + s = s[0:line_length - 11] with open(fpath, "w") as fd: for i in range(int(fsize / line_length)): fd.write(f"{i:09d}-{s}\n") remain = int(fsize % line_length) if remain != 0: i = int(fsize / line_length) + 1 - fd.write(f"{i:09d}-{s}"[0 : remain - 1] + "\n") + fd.write(f"{i:09d}-{s}"[0:remain - 1] + "\n") return fpath def make_data_gzipbomb(self, indir: str, fname: str, fsize: int) -> str: diff --git a/tests/http/testenv/h2o.py b/tests/http/testenv/h2o.py index deb3608d3a..e6241c2b4b 100644 --- a/tests/http/testenv/h2o.py +++ b/tests/http/testenv/h2o.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- # *************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -133,7 +131,7 @@ class H2o: self._loaded_cred_name = self._cred_name self.write_config() args = [self._cmd, "-c", self._conf_file] - self._error_fd = open(self._stderr, "a") + self._error_fd = open(self._stderr, "a") # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/httpd.py b/tests/http/testenv/httpd.py index 10ccce0c4a..c2a0a22b8f 100644 --- a/tests/http/testenv/httpd.py +++ b/tests/http/testenv/httpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -583,9 +581,8 @@ class Httpd: if not os.path.exists(out_source) or \ os.stat(in_source).st_mtime > os.stat(out_source).st_mtime: shutil.copy(in_source, out_source) - p = subprocess.run([ - self.env.apxs, '-c', out_source - ], capture_output=True, cwd=out_dir, check=False) + p = subprocess.run([self.env.apxs, '-c', out_source], + capture_output=True, cwd=out_dir, check=False) rv = p.returncode if rv != 0: log.error(f"compiling mod_curltest failed: {p.stderr}") diff --git a/tests/http/testenv/nghttpx.py b/tests/http/testenv/nghttpx.py index 37c72ad945..3caa99dcca 100644 --- a/tests/http/testenv/nghttpx.py +++ b/tests/http/testenv/nghttpx.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -270,7 +268,7 @@ class NghttpxQuic(Nghttpx): '--frontend-http3-max-connection-window-size=100M', # f'--frontend-quic-debug-log', ]) - self._error_fd = open(self._stderr, 'a') + self._error_fd = open(self._stderr, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False @@ -320,7 +318,7 @@ class NghttpxFwd(Nghttpx): creds.pkey_file, creds.cert_file, ] - self._error_fd = open(self._stderr, 'a') + self._error_fd = open(self._stderr, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/ports.py b/tests/http/testenv/ports.py index 10accb2f3b..2436d40767 100644 --- a/tests/http/testenv/ports.py +++ b/tests/http/testenv/ports.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/testenv/sshd.py b/tests/http/testenv/sshd.py index 49c39ce494..57c7d1e34a 100644 --- a/tests/http/testenv/sshd.py +++ b/tests/http/testenv/sshd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -235,7 +233,7 @@ class Sshd: run_env = os.environ.copy() # does not have any effect, sadly # run_env['HOME'] = f'{self._home_dir}' - self._error_fd = open(self._sshd_log, 'a') + self._error_fd = open(self._sshd_log, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd, env=run_env) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/vsftpd.py b/tests/http/testenv/vsftpd.py index e2c33edee3..7cd9596b16 100644 --- a/tests/http/testenv/vsftpd.py +++ b/tests/http/testenv/vsftpd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -146,7 +144,7 @@ class VsFTPD: self._cmd, f'{self._conf_file}', ] - self._error_fd = open(self._error_log, 'a') + self._error_fd = open(self._error_log, 'a') # noqa: SIM115 self._process = subprocess.Popen(args=args, stderr=self._error_fd) if self._process.returncode is not None: return False diff --git a/tests/http/testenv/ws_4frames_server.py b/tests/http/testenv/ws_4frames_server.py index 8d5655aa5c..42d6e9dc29 100755 --- a/tests/http/testenv/ws_4frames_server.py +++ b/tests/http/testenv/ws_4frames_server.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/http/testenv/ws_echo_server.py b/tests/http/testenv/ws_echo_server.py index fddd26f271..a063b03079 100755 --- a/tests/http/testenv/ws_echo_server.py +++ b/tests/http/testenv/ws_echo_server.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py index a65b156630..4e65b62ec4 100755 --- a/tests/negtelnetserver.py +++ b/tests/negtelnetserver.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Project ___| | | | _ \| | # / __| | | | |_) | | diff --git a/tests/smbserver.py b/tests/smbserver.py index 44daefc15a..6623aac708 100755 --- a/tests/smbserver.py +++ b/tests/smbserver.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Project ___| | | | _ \| | # / __| | | | |_) | | @@ -153,8 +152,9 @@ def smbserver(options): class TestSmbServer(imp_smbserver.SMBSERVER): """ - Test server for SMB which subclasses the impacket SMBSERVER and provides - test functionality. + Test server for SMB. + + It subclasses the impacket SMBSERVER and provides test functionality. """ def __init__(self, @@ -176,9 +176,10 @@ class TestSmbServer(imp_smbserver.SMBSERVER): def create_and_x(self, conn_id, smb_server, smb_command, recv_packet): """ - Our version of smbComNtCreateAndX looks for special test files and - fools the rest of the framework into opening them as if they were - normal files. + Our version of smbComNtCreateAndX. + + It looks for special test files and fools the rest of the framework + into opening them as if they were normal files. """ conn_data = smb_server.getConnectionData(conn_id) @@ -372,9 +373,9 @@ def get_options(): parser = argparse.ArgumentParser() parser.add_argument("--port", action="store", default=9017, - type=int, help="port to listen on") + type=int, help="port to listen on") parser.add_argument("--host", action="store", default="127.0.0.1", - help="host to listen on") + help="host to listen on") parser.add_argument("--verbose", action="store", type=int, default=0, help="verbose output") parser.add_argument("--pidfile", action="store", diff --git a/tests/util.py b/tests/util.py index 2921e93aa8..ef212da073 100755 --- a/tests/util.py +++ b/tests/util.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Project ___| | | | _ \| | # / __| | | | |_) | |