From 39cb1a5f65a2d5970b9639e3e324ad7953d261f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Tue, 12 Dec 2017 00:26:33 +0200 Subject: Added support for creating cron triggers from crontab expressions Fixes #240. --- tests/test_triggers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/test_triggers.py b/tests/test_triggers.py index ca07963..34372a5 100644 --- a/tests/test_triggers.py +++ b/tests/test_triggers.py @@ -387,6 +387,18 @@ class TestCronTrigger(object): def test_invalid_ranges(self, values, expected): pytest.raises(ValueError, CronTrigger, **values).match(expected) + @pytest.mark.parametrize('expr, expected_repr', [ + ('* * * * *', + ""), + ('0-14 * 14-28 jul fri', + "") + ], ids=['always', 'assorted']) + def test_from_crontab(self, expr, expected_repr, timezone): + trigger = CronTrigger.from_crontab(expr, timezone) + assert repr(trigger) == expected_repr + class TestDateTrigger(object): @pytest.mark.parametrize('run_date,alter_tz,previous,now,expected', [ -- cgit v1.2.1