File: de-Python3.5_tests.patch

package info (click to toggle)
apscheduler 3.7.0-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 848 kB
  • sloc: python: 5,689; makefile: 6
file content (82 lines) | stat: -rw-r--r-- 3,053 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: remove Python 3.5 bits from a test
 Tests are tried with Python 2.7 as well, remove Python 3.5 concurrent
 keywords from the specific test.
Forwarded: no
Author: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Last-Update: 2018-03-24

---

--- apscheduler-3.5.1.orig/tests/test_executors_py35.py
+++ apscheduler-3.5.1/tests/test_executors_py35.py
@@ -1,5 +1,7 @@
 """Contains test functions using Python 3.3+ syntax."""
-from asyncio import CancelledError
+import sys
+if (sys.version_info > (3, 5)):
+    from asyncio import CancelledError
 from datetime import datetime
 
 import pytest
@@ -42,8 +44,8 @@ def tornado_executor(tornado_scheduler):
     executor.shutdown()
 
 
-async def waiter(sleep, exception):
-    await sleep(0.1)
+def waiter(sleep, exception):
+    sleep(0.1)
     if exception:
         raise Exception('dummy error')
     else:
@@ -52,7 +54,7 @@ async def waiter(sleep, exception):
 
 @pytest.mark.parametrize('exception', [False, True])
 @pytest.mark.asyncio
-async def test_run_coroutine_job(asyncio_scheduler, asyncio_executor, exception):
+def test_run_coroutine_job(asyncio_scheduler, asyncio_executor, exception):
     from asyncio import Future, sleep
 
     future = Future()
@@ -60,7 +62,7 @@ async def test_run_coroutine_job(asyncio
     asyncio_executor._run_job_success = lambda job_id, events: future.set_result(events)
     asyncio_executor._run_job_error = lambda job_id, exc, tb: future.set_exception(exc)
     asyncio_executor.submit_job(job, [datetime.now(utc)])
-    events = await future
+    events = future
     assert len(events) == 1
     if exception:
         assert str(events[0].exception) == 'dummy error'
@@ -70,7 +72,7 @@ async def test_run_coroutine_job(asyncio
 
 @pytest.mark.parametrize('exception', [False, True])
 @pytest.mark.gen_test
-async def test_run_coroutine_job_tornado(tornado_scheduler, tornado_executor, exception):
+def test_run_coroutine_job_tornado(tornado_scheduler, tornado_executor, exception):
     from tornado.concurrent import Future
     from tornado.gen import sleep
 
@@ -79,7 +81,7 @@ async def test_run_coroutine_job_tornado
     tornado_executor._run_job_success = lambda job_id, events: future.set_result(events)
     tornado_executor._run_job_error = lambda job_id, exc, tb: future.set_exception(exc)
     tornado_executor.submit_job(job, [datetime.now(utc)])
-    events = await future
+    events = future
     assert len(events) == 1
     if exception:
         assert str(events[0].exception) == 'dummy error'
@@ -88,7 +90,7 @@ async def test_run_coroutine_job_tornado
 
 
 @pytest.mark.asyncio
-async def test_asyncio_executor_shutdown(asyncio_scheduler, asyncio_executor):
+def test_asyncio_executor_shutdown(asyncio_scheduler, asyncio_executor):
     """Test that the AsyncIO executor cancels its pending tasks on shutdown."""
     from asyncio import sleep
 
@@ -99,4 +101,4 @@ async def test_asyncio_executor_shutdown
 
     asyncio_executor.shutdown()
     with pytest.raises(CancelledError):
-        await futures.pop()
+        futures.pop()