Skip to content

Commit ca69110

Browse files
frozencemeterysimo5
authored andcommitted
Update Python syntax for machine readability
- Treat `print()` only as a function - Treat `del` only as a keyword - Use modern octal notation - Perform idiomatic set non-membership check Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 parent 838ed87 commit ca69110

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tests/magtests.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import sys
1212

1313
# check that we can import requests (for use in test scripts)
14-
import requests, requests_kerberos
15-
del(requests)
16-
del(requests_kerberos)
14+
import requests
15+
import requests_kerberos
16+
del requests
17+
del requests_kerberos
1718

1819
def parse_args():
1920
parser = argparse.ArgumentParser(
@@ -209,7 +210,7 @@ def setup_test_certs(testdir, testenv, logfile):
209210
with open(opensslcnf, 'w+') as f:
210211
f.write(text)
211212

212-
print pkinit_key
213+
print(pkinit_key)
213214
cmd = subprocess.Popen(["openssl", "genrsa", "-out", pkinit_key,
214215
"2048"], stdout=logfile,
215216
stderr=logfile, env=testenv,

tests/t_basic_k5_fail_second.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
r = s.get(url)
2424
if r.status_code == 200:
2525
raise ValueError('Basic Auth: Got Success while expecting Error')
26-
if not 'GSS ERROR' in r.text:
26+
if 'GSS ERROR' not in r.text:
2727
raise ValueError('Basic Auth: Expected error variable is missing')
2828

2929
url = 'http://%s:%s@%s/basic_auth_krb5/' % \

tests/t_spnego.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
raise ValueError('gssapi_session not set')
2020

2121
data = os.stat(os.environ['DELEGCCACHE'])
22-
if data[ST_MODE] != 0100666:
22+
if data[ST_MODE] != 0o100666:
2323
raise ValueError('Incorrect perm on ccache: %o' % data[ST_MODE])

0 commit comments

Comments
 (0)