Gating the cron tests for the scheduler to ensure that the croniter module is installed before we attempt to run these tests

This commit is contained in:
Gareth J. Greenaway 2017-12-28 11:19:50 -08:00
parent 2f4653e271
commit a9c36b08ff
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -16,6 +16,7 @@ from tests.support.mixins import SaltReturnAssertsMixin
# Import Salt Testing Libs
from tests.support.mock import MagicMock, patch
from tests.support.unit import skipIf
import tests.integration as integration
# Import Salt libs
@ -23,6 +24,12 @@ import salt.utils.schedule
from salt.modules.test import ping as ping
try:
import croniter # pylint: disable=W0611
HAS_CRONITER = True
except ImportError:
HAS_CRONITER = False
log = logging.getLogger(__name__)
ROOT_DIR = os.path.join(integration.TMP, 'schedule-unit-tests')
SOCK_DIR = os.path.join(ROOT_DIR, 'test-socks')
@ -215,6 +222,7 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.schedule.job_status('job1')
self.assertEqual(ret['_last_run'], run_time)
@skipIf(not HAS_CRONITER, 'Cannot find croniter python module')
def test_eval_cron(self):
'''
verify that scheduled job runs
@ -238,6 +246,7 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
ret = self.schedule.job_status('job1')
self.assertEqual(ret['_last_run'], run_time)
@skipIf(not HAS_CRONITER, 'Cannot find croniter python module')
def test_eval_cron_loop_interval(self):
'''
verify that scheduled job runs