Skip to content

Commit 3d9212c

Browse files
committed
Remove Python 2 skip and workarounds in unit tests
1 parent 03e0236 commit 3d9212c

4 files changed

Lines changed: 0 additions & 19 deletions

File tree

tests/unit/ssg-module/test_build_yaml.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import collections
33
import os
44
import tempfile
5-
import sys
65

76
import yaml
87
import pytest
@@ -454,7 +453,6 @@ def rule_accounts_tmout():
454453
return ssg.build_yaml.Rule.from_yaml(rule_file)
455454

456455

457-
@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
458456
def test_rule_to_xml_element(rule_accounts_tmout):
459457
xmldiff_main = pytest.importorskip("xmldiff.main")
460458
rule_el = rule_accounts_tmout.to_xml_element()
@@ -487,7 +485,6 @@ def value_system_crypto_policy():
487485
return ssg.build_yaml.Value.from_yaml(value_file)
488486

489487

490-
@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
491488
def test_value_to_xml_element(value_system_crypto_policy):
492489
xmldiff_main = pytest.importorskip("xmldiff.main")
493490
value_el = value_system_crypto_policy.to_xml_element()

tests/unit/ssg-module/test_controls.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22
import os
3-
import sys
43

54
import ssg.controls
65
import ssg.build_yaml
@@ -104,7 +103,6 @@ def test_controls_load(controls_manager):
104103
_load_test(controls_manager, "abcd")
105104

106105

107-
@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
108106
def test_controls_invalid_rules(env_yaml):
109107
existing_rules = {"accounts_tmout", "configure_crypto_policy"}
110108
controls_manager = ssg.controls.ControlsManager(
@@ -115,7 +113,6 @@ def test_controls_invalid_rules(env_yaml):
115113
"Control abcd:R1 contains nonexisting rule(s) sshd_set_idle_timeout"
116114

117115

118-
@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
119116
def test_controls_levels(controls_manager):
120117
# Default level is the lowest level
121118
c_1 = controls_manager.get_control("abcd-levels", "S1")

tests/unit/ssg_test_suite/test_assert_reference_unique.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import os
2-
import pytest
32
import subprocess
4-
import sys
5-
6-
if sys.version_info < (3, 0):
7-
try:
8-
# pytest v4.6 has allow_module_level
9-
pytest.skip("requires python3", allow_module_level=True)
10-
except TypeError:
11-
# older pytest v2.7 does not have it and it is implied
12-
pytest.skip("requires python3")
133

144
DATADIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
155
CMD = os.path.abspath(

tests/unit/utils/test_generate_most_used_rules.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import os
2-
import sys
3-
import pytest
42
from argparse import Namespace
53
from utils.profile_tool import command_most_used_rules
64

@@ -16,7 +14,6 @@ def get_fake_args():
1614
)
1715

1816

19-
@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3")
2017
def test_command(capsys):
2118
command_most_used_rules(get_fake_args())
2219
captured = capsys.readouterr()

0 commit comments

Comments
 (0)