diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-08-17 00:39:49 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2022-08-17 00:39:49 +0300 |
commit | cb56624154fa69ddafb82349a465419aacac1caa (patch) | |
tree | dceeec9884916bb77977f09a1f0fabf8b22fc972 /tests | |
parent | de722a1b8985cf6308ba602e8e7b8bab21349448 (diff) | |
download | apscheduler-cb56624154fa69ddafb82349a465419aacac1caa.tar.gz |
Formatted all code to fit within Black's 88 column limit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_datastores.py | 30 | ||||
-rw-r--r-- | tests/test_schedulers.py | 3 | ||||
-rw-r--r-- | tests/triggers/test_calendarinterval.py | 8 | ||||
-rw-r--r-- | tests/triggers/test_combining.py | 5 | ||||
-rw-r--r-- | tests/triggers/test_cron.py | 8 |
5 files changed, 29 insertions, 25 deletions
diff --git a/tests/test_datastores.py b/tests/test_datastores.py index 40fad27..3159a9e 100644 --- a/tests/test_datastores.py +++ b/tests/test_datastores.py @@ -323,8 +323,8 @@ class TestDataStores: schedules3 = datastore.acquire_schedules("dummy-id3", 1) assert not schedules3 - # Update the schedules and check that the job store actually deletes the first - # one and updates the second one + # Update the schedules and check that the job store actually deletes the + # first one and updates the second one schedules1[0].next_fire_time = None schedules2[0].next_fire_time = datetime(2020, 9, 15, tzinfo=timezone.utc) @@ -388,8 +388,8 @@ class TestDataStores: self, datastore: DataStore, schedules: list[Schedule], freezer ) -> None: """ - Test that a scheduler can acquire schedules that were acquired by another scheduler but - not released within the lock timeout period. + Test that a scheduler can acquire schedules that were acquired by another + scheduler but not released within the lock timeout period. """ datastore.add_schedule(schedules[0], ConflictPolicy.exception) @@ -542,8 +542,8 @@ class TestDataStores: self, datastore: DataStore, freezer: FrozenDateTimeFactory ) -> None: """ - Test that a worker can acquire jobs that were acquired by another scheduler but not - released within the lock timeout period. + Test that a worker can acquire jobs that were acquired by another scheduler but + not released within the lock timeout period. """ datastore.add_task(Task(id="task1", func=asynccontextmanager)) @@ -574,7 +574,8 @@ class TestDataStores: for job in jobs: datastore.add_job(job) - # Check that only 2 jobs are returned from acquire_jobs() even though the limit wqas 3 + # Check that only 2 jobs are returned from acquire_jobs() even though the limit + # wqas 3 acquired_jobs = datastore.acquire_jobs("worker1", 3) assert [job.id for job in acquired_jobs] == [job.id for job in jobs[:2]] @@ -784,8 +785,8 @@ class TestAsyncDataStores: schedules3 = await datastore.acquire_schedules("dummy-id3", 1) assert not schedules3 - # Update the schedules and check that the job store actually deletes the first - # one and updates the second one + # Update the schedules and check that the job store actually deletes the + # first one and updates the second one schedules1[0].next_fire_time = None schedules2[0].next_fire_time = datetime(2020, 9, 15, tzinfo=timezone.utc) @@ -851,8 +852,8 @@ class TestAsyncDataStores: self, datastore: AsyncDataStore, schedules: list[Schedule], freezer ) -> None: """ - Test that a scheduler can acquire schedules that were acquired by another scheduler but - not released within the lock timeout period. + Test that a scheduler can acquire schedules that were acquired by another + scheduler but not released within the lock timeout period. """ await datastore.add_schedule(schedules[0], ConflictPolicy.exception) @@ -1002,8 +1003,8 @@ class TestAsyncDataStores: self, datastore: AsyncDataStore, freezer: FrozenDateTimeFactory ) -> None: """ - Test that a worker can acquire jobs that were acquired by another scheduler but not - released within the lock timeout period. + Test that a worker can acquire jobs that were acquired by another scheduler but + not released within the lock timeout period. """ await datastore.add_task(Task(id="task1", func=asynccontextmanager)) @@ -1036,7 +1037,8 @@ class TestAsyncDataStores: for job in jobs: await datastore.add_job(job) - # Check that only 2 jobs are returned from acquire_jobs() even though the limit wqas 3 + # Check that only 2 jobs are returned from acquire_jobs() even though the limit + # wqas 3 acquired_jobs = await datastore.acquire_jobs("worker1", 3) assert [job.id for job in acquired_jobs] == [job.id for job in jobs[:2]] diff --git a/tests/test_schedulers.py b/tests/test_schedulers.py index f57cbeb..589b753 100644 --- a/tests/test_schedulers.py +++ b/tests/test_schedulers.py @@ -393,7 +393,8 @@ class TestSyncScheduler: fake_uniform.assert_called_once_with(0, expected_upper_bound) - # Check that the job was created with the proper amount of jitter in its scheduled time + # Check that the job was created with the proper amount of jitter in its + # scheduled time jobs = scheduler.data_store.get_jobs({job_id}) assert jobs[0].jitter == timedelta(seconds=jitter) assert jobs[0].scheduled_fire_time == orig_start_time + timedelta( diff --git a/tests/triggers/test_calendarinterval.py b/tests/triggers/test_calendarinterval.py index 4466c34..ea929af 100644 --- a/tests/triggers/test_calendarinterval.py +++ b/tests/triggers/test_calendarinterval.py @@ -39,8 +39,8 @@ def test_end_date(timezone, serializer): def test_missing_time(timezone, serializer): """ - Test that if the designated time does not exist on a day due to a forward DST shift, the day is - skipped entirely. + Test that if the designated time does not exist on a day due to a forward DST shift, + the day is skipped entirely. """ trigger = CalendarIntervalTrigger( @@ -54,8 +54,8 @@ def test_missing_time(timezone, serializer): def test_repeated_time(timezone, serializer): """ - Test that if the designated time is repeated during a day due to a backward DST shift, the task - is executed on the earlier occurrence of that time. + Test that if the designated time is repeated during a day due to a backward DST + shift, the task is executed on the earlier occurrence of that time. """ trigger = CalendarIntervalTrigger( diff --git a/tests/triggers/test_combining.py b/tests/triggers/test_combining.py index 942bf49..8be7387 100644 --- a/tests/triggers/test_combining.py +++ b/tests/triggers/test_combining.py @@ -57,8 +57,9 @@ class TestAndTrigger: assert repr(trigger) == ( "AndTrigger([IntervalTrigger(seconds=4, " - "start_time='2020-05-16 14:17:30.254212+02:00'), IntervalTrigger(seconds=4, " - "start_time='2020-05-16 14:17:32.254212+02:00')], threshold=1.0, max_iterations=10000)" + "start_time='2020-05-16 14:17:30.254212+02:00'), IntervalTrigger(" + "seconds=4, start_time='2020-05-16 14:17:32.254212+02:00')], " + "threshold=1.0, max_iterations=10000)" ) diff --git a/tests/triggers/test_cron.py b/tests/triggers/test_cron.py index eb832e7..76e3b62 100644 --- a/tests/triggers/test_cron.py +++ b/tests/triggers/test_cron.py @@ -227,8 +227,8 @@ def test_last_weekday(timezone, serializer): def test_increment_weekday(timezone, serializer): """ - Tests that incrementing the weekday field in the process of calculating the next matching - date won't cause problems. + Tests that incrementing the weekday field in the process of calculating the next + matching date won't cause problems. """ start_time = datetime(2009, 9, 25, 7, tzinfo=timezone) @@ -386,8 +386,8 @@ def test_dst_change( ): """ Making sure that CronTrigger works correctly when crossing the DST switch threshold. - Note that you should explicitly compare datetimes as strings to avoid the internal datetime - comparison which would test for equality in the UTC timezone. + Note that you should explicitly compare datetimes as strings to avoid the internal + datetime comparison which would test for equality in the UTC timezone. """ timezone = ZoneInfo("US/Eastern") |