Skip to content

Commit 7a49e7c

Browse files
pep8 compliance of test scripts
1 parent d1fcf66 commit 7a49e7c

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

tests/bindings/python/benchmark_import_results.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@
2626
print(rs.get_idref(), result2str(rs.get_result()))
2727

2828
if (rs.get_idref() == "R-SHOULD_PASS" and
29-
rs.get_result() != oscap.xccdf.XCCDF_RESULT_PASS):
30-
29+
rs.get_result() != oscap.xccdf.XCCDF_RESULT_PASS):
30+
3131
raise Exception("Rule result for {0} should be PASS but is currently {1}."
3232
.format(rs.get_idref(),
3333
result2str(rs.get_result())))
34-
34+
3535
elif (rs.get_idref() == "R-SHOULD_FAIL" and
36-
rs.get_result() != oscap.xccdf.XCCDF_RESULT_FAIL):
37-
36+
rs.get_result() != oscap.xccdf.XCCDF_RESULT_FAIL):
37+
3838
raise Exception("Rule result for {0} should be FAIL but is currently {1}."
3939
.format(rs.get_idref(),
4040
result2str(rs.get_result())))
41-
41+
4242

4343
# Now ensure that benchmark_import return None if the file doesn't exists
4444

tests/bindings/python/introspection_features.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,41 @@
88
# - Test the presence or the absence of expected builtins functions
99
# - Indentify a constant name by its value and prefix (prefix XCCDF_RESULT
1010
# with value 1 (usually) should identify XCCDF_RESULT_PASS
11-
# - Check presence of constants filtered by a prefix (XCCDF_RESULT with
11+
# - Check presence of constants filtered by a prefix (XCCDF_RESULT with
1212
# value = None should returns all XCCDF_RESULT_* constants).
1313
#
1414

1515

1616
from import_handler import oscap
1717
from pprint import pprint
1818

19-
oval_funcs=oscap.oval.introspect()
19+
oval_funcs = oscap.oval.introspect()
2020

2121
if oval_funcs.get('oval_variable_get_values') is None:
2222
raise Exception("method 'oval_variable_get_values' not found in builtins"
2323
"functions of oval object (should be in oscap.oval.introspect())")
2424

25-
if oval_funcs.get('xccdf_check_get_id') is not None:
25+
if oval_funcs.get('xccdf_check_get_id') is not None:
2626
raise Exception("method 'xccdf_check_get_id' should not be found in "
2727
"oscap.oval.introspect(), because the prefix isn't 'oval')")
2828

29-
if oscap.oval.introspect_all().get('xccdf_check_get_id') is None:
30-
raise Exception("method 'xccdf_check_get_id' should be present in "
31-
"oscap.oval.introspect_all(), which returns all available builtins functions")
32-
29+
if oscap.oval.introspect_all().get('xccdf_check_get_id') is None:
30+
raise Exception("method 'xccdf_check_get_id' should be present in "
31+
"oscap.oval.introspect_all(), which returns all available builtins functions")
32+
3333
print("Introspection of builtins functions seems working.")
3434

3535

3636
# should returns {'XCCDF_RESULT_PASS': 1}
3737
# but it's not impossible that the numeric value change (in fact we don't care of it)
38-
pass_val=oscap.oval.XCCDF_RESULT_PASS # is usually 1
38+
pass_val = oscap.oval.XCCDF_RESULT_PASS # is usually 1
3939

40-
var1=oscap.oval.introspect_constants(pass_val, "XCCDF_RESULT")
41-
if len(var1) == 1 and list(var1.keys())[0]=="XCCDF_RESULT_PASS":
42-
print("Introspection of oscap.oval.XCCDF_RESULT_PASS ok");
40+
var1 = oscap.oval.introspect_constants(pass_val, "XCCDF_RESULT")
41+
if len(var1) == 1 and list(var1.keys())[0] == "XCCDF_RESULT_PASS":
42+
print("Introspection of oscap.oval.XCCDF_RESULT_PASS ok")
4343

4444

45-
xccdf_results=oscap.oval.introspect_constants(None, "XCCDF_RESULT")
45+
xccdf_results = oscap.oval.introspect_constants(None, "XCCDF_RESULT")
4646
# should returns something like {
4747
# 'XCCDF_RESULT_ERROR': 3,
4848
# 'XCCDF_RESULT_FAIL': 2,
@@ -55,7 +55,7 @@
5555
# 'XCCDF_RESULT_UNKNOWN': 4}
5656

5757
expected_constants = ('XCCDF_RESULT_ERROR', 'XCCDF_RESULT_FAIL', 'XCCDF_RESULT_FIXED',
58-
'XCCDF_RESULT_INFORMATIONAL', 'XCCDF_RESULT_NOT_APPLICABLE',
58+
'XCCDF_RESULT_INFORMATIONAL', 'XCCDF_RESULT_NOT_APPLICABLE',
5959
'XCCDF_RESULT_NOT_CHECKED', 'XCCDF_RESULT_PASS',
6060
'XCCDF_RESULT_NOT_SELECTED', 'XCCDF_RESULT_UNKNOWN')
6161

@@ -64,4 +64,4 @@
6464
raise Exception("oscap.oval.introspect_constants(None, 'XCCDF_RESULT) should"
6565
"contains the constant {0}.".format(c))
6666

67-
print("Introspection of constants ok with prefix XCCDF_RESULT_*");
67+
print("Introspection of constants ok with prefix XCCDF_RESULT_*")

tests/bindings/python/oval_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# to provide convenience utilities.
1010
#
1111

12+
1213
def browse_criteria(crit_node, mode=0):
1314
'''
1415
Browse recursively criteria of an oval test and build a representation of it

0 commit comments

Comments
 (0)