Skip to content

Commit

Permalink
Skipp tests that behave strangely in python2
Browse files Browse the repository at this point in the history
  • Loading branch information
Honny1 committed Sep 27, 2023
1 parent 145c1f7 commit 44b1209
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/unit/ssg-module/test_build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import collections
import os
import tempfile
import sys

import yaml
import pytest
Expand Down Expand Up @@ -437,6 +438,7 @@ def rule_accounts_tmout():
return ssg.build_yaml.Rule.from_yaml(rule_file)


@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
def test_rule_to_xml_element(rule_accounts_tmout):
xmldiff_main = pytest.importorskip("xmldiff.main")
rule_el = rule_accounts_tmout.to_xml_element()
Expand Down Expand Up @@ -469,6 +471,7 @@ def value_system_crypto_policy():
return ssg.build_yaml.Value.from_yaml(value_file)


@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
def test_value_to_xml_element(value_system_crypto_policy):
xmldiff_main = pytest.importorskip("xmldiff.main")
value_el = value_system_crypto_policy.to_xml_element()
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/ssg-module/test_controls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
import logging
import os
import sys

import ssg.controls
import ssg.build_yaml
Expand Down Expand Up @@ -98,6 +99,7 @@ def test_controls_load(controls_manager):
_load_test(controls_manager, "abcd")


@pytest.mark.skipif(sys.version_info[0] < 3, reason="requires python3 or higher")
def test_controls_invalid_rules(env_yaml):
existing_rules = {"accounts_tmout", "configure_crypto_policy"}
controls_manager = ssg.controls.ControlsManager(
Expand All @@ -107,6 +109,8 @@ def test_controls_invalid_rules(env_yaml):
assert str(exc.value) == \
"Control abcd:R1 contains nonexisting rule(s) sshd_set_idle_timeout"


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

0 comments on commit 44b1209

Please sign in to comment.