diff options
-rw-r--r-- | tests/report_tests/smoke_tests.py | 4 | ||||
-rw-r--r-- | tests/sos_tests.py | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/report_tests/smoke_tests.py b/tests/report_tests/smoke_tests.py index cc186a91..89d5e301 100644 --- a/tests/report_tests/smoke_tests.py +++ b/tests/report_tests/smoke_tests.py @@ -10,7 +10,7 @@ import re from avocado.utils import process -from sos_tests import StageOneReportTest, SOS_BIN, skipIf, RH_DIST +from sos_tests import StageOneReportTest, SOS_BIN, redhat_only # These are the header strings in --list-plugins output @@ -44,7 +44,7 @@ class AllPluginSmokeTest(StageOneReportTest): for plugin in self.plugs: self.assertPluginIncluded(plugin) - @skipIf(lambda x: x.local_distro not in RH_DIST, "Not distro relevant") + @redhat_only def test_expected_warnings_displayed(self): """We can expect specific plugins to always generate a warning during setup if they are enabled on systems that are not configured for those diff --git a/tests/sos_tests.py b/tests/sos_tests.py index 6af7d60a..36969988 100644 --- a/tests/sos_tests.py +++ b/tests/sos_tests.py @@ -27,7 +27,7 @@ SOS_TEST_DATA_DIR = os.path.realpath(os.path.join(SOS_TEST_DIR, 'test_data')) SOS_BIN = os.path.realpath(os.path.join(SOS_TEST_DIR, '../bin/sos')) RH_DIST = ['rhel', 'centos', 'fedora'] -UBUNTU_DIST = ['ubuntu', 'debian'] +UBUNTU_DIST = ['Ubuntu', 'debian'] def skipIf(cond, message=None): def decorator(function): @@ -40,6 +40,17 @@ def skipIf(cond, message=None): return wrapper return decorator +def redhat_only(tst): + def wrapper(func): + if distro.detect().name not in RH_DIST: + raise TestSkipError('Not running on a Red Hat distro') + return wrapper + +def ubuntu_only(tst): + def wrapper(func): + if distro.detect().name not in UBUNTU_DIST: + raise TestSkipError('Not running on a Ubuntu or Debian distro') + return wrapper class BaseSoSTest(Test): """Base class for all our test classes to build off of. |