diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-04-21 05:22:39 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-04-21 05:22:39 +0300 |
commit | e503c3c55357ef427ffae851c92a7542be22b254 (patch) | |
tree | d3ffa37500015bd717a0e93c37f824b6e4b3445b /tests | |
parent | a2dda8fec6757ec2b09cd5ef4f9d9815a14ba5fe (diff) | |
download | apscheduler-e503c3c55357ef427ffae851c92a7542be22b254.tar.gz |
Added configurable job defaults for max_instances and max_runs and enabled a setting of None for misfire_grace_time
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_schedulers.py | 15 | ||||
-rw-r--r-- | tests/test_util.py | 6 |
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/test_schedulers.py b/tests/test_schedulers.py index 533c02f..b8bd6b5 100644 --- a/tests/test_schedulers.py +++ b/tests/test_schedulers.py @@ -99,14 +99,17 @@ class TestOfflineScheduler(object): def test_configure_no_prefix(self, scheduler): global_options = {'misfire_grace_time': '2', 'coalesce': 'false'} scheduler.configure(global_options) - assert scheduler.misfire_grace_time == 1 - assert scheduler.coalesce is True + assert scheduler._job_defaults['misfire_grace_time'] == 1 + assert scheduler._job_defaults['coalesce'] is True def test_configure_prefix(self, scheduler): - global_options = {'apscheduler.misfire_grace_time': 2, 'apscheduler.coalesce': False} + global_options = { + 'apscheduler.job_defaults.misfire_grace_time': 2, + 'apscheduler.job_defaults.coalesce': False + } scheduler.configure(global_options) - assert scheduler.misfire_grace_time == 2 - assert scheduler.coalesce is False + assert scheduler._job_defaults['misfire_grace_time'] == 2 + assert scheduler._job_defaults['coalesce'] is False def test_add_listener(self, scheduler): val = [] @@ -336,7 +339,7 @@ class TestRunningScheduler(object): assert 'DummyException' in logstream.getvalue() def test_misfire_grace_time(self, scheduler): - scheduler.misfire_grace_time = 3 + scheduler._job_defaults['misfire_grace_time'] = 3 job = scheduler.add_job(lambda: None, 'interval', seconds=1) assert job.misfire_grace_time == 3 diff --git a/tests/test_util.py b/tests/test_util.py index 8f31ed7..4bb7d50 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -231,6 +231,12 @@ class TestCheckCallableArgs(object): exc = pytest.raises(ValueError, check_callable_args, lambda x, y: None, [1, 2], {'y': 1}) assert str(exc.value) == 'The following arguments are supplied in both args and kwargs: y' + def test_positional_only_args(self): + """Tests that an attempt to use keyword arguments for positional-only arguments raises an exception.""" + + exc = pytest.raises(ValueError, check_callable_args, pow, [1], {'y': 1}) + assert str(exc.value) == 'The following arguments are supplied in both args and kwargs: y' + @minpython(3) def test_unfulfilled_kwargs(self): """Tests that attempting to schedule a job where not all keyword-only arguments are fulfilled raises an |