Commit 2324b99c authored by Stefan Behnel's avatar Stefan Behnel

Prevent C compiler from seeing "1/0" in test code. MSVC is heavily upset about it.

parent 32b9dd8c
...@@ -17,6 +17,8 @@ import contextlib ...@@ -17,6 +17,8 @@ import contextlib
#asyncio = import_module("asyncio") #asyncio = import_module("asyncio")
ZERO = 0
try: try:
if sys.version_info[:2] == (3, 4): if sys.version_info[:2] == (3, 4):
# asnycio in Py3.4 does not support awaitable coroutines (requires iterators instead) # asnycio in Py3.4 does not support awaitable coroutines (requires iterators instead)
...@@ -343,7 +345,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -343,7 +345,7 @@ class AsyncGenTest(unittest.TestCase):
async def gen(): async def gen():
await awaitable() await awaitable()
yield 123 yield 123
1 / 0 1 / ZERO
g = gen() g = gen()
ai = g.__aiter__() ai = g.__aiter__()
...@@ -381,7 +383,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -381,7 +383,7 @@ class AsyncGenTest(unittest.TestCase):
def sync_gen(): def sync_gen():
try: try:
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
yield 2 yield 2
yield 3 yield 3
...@@ -391,7 +393,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -391,7 +393,7 @@ class AsyncGenTest(unittest.TestCase):
async def async_gen(): async def async_gen():
try: try:
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
yield 2 yield 2
yield 3 yield 3
...@@ -406,7 +408,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -406,7 +408,7 @@ class AsyncGenTest(unittest.TestCase):
yield 1 yield 1
finally: finally:
yield 2 yield 2
1 / 0 1 / ZERO
yield 3 yield 3
yield 100 yield 100
...@@ -418,7 +420,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -418,7 +420,7 @@ class AsyncGenTest(unittest.TestCase):
finally: finally:
await awaitable() await awaitable()
yield 2 yield 2
1 / 0 1 / ZERO
yield 3 yield 3
yield 100 yield 100
...@@ -429,7 +431,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -429,7 +431,7 @@ class AsyncGenTest(unittest.TestCase):
def sync_gen(): def sync_gen():
try: try:
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
yield 2 yield 2
yield 3 yield 3
...@@ -440,7 +442,7 @@ class AsyncGenTest(unittest.TestCase): ...@@ -440,7 +442,7 @@ class AsyncGenTest(unittest.TestCase):
try: try:
await awaitable() await awaitable()
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
yield 2 yield 2
await awaitable() await awaitable()
...@@ -513,7 +515,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -513,7 +515,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1 yield 1
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01, loop=self.loop)
yield 2 yield 2
1 / 0 1 / ZERO
yield 3 yield 3
with self.assertRaises(ZeroDivisionError): with self.assertRaises(ZeroDivisionError):
...@@ -689,7 +691,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -689,7 +691,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def foo(): async def foo():
try: try:
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01, loop=self.loop)
yield 12 yield 12
...@@ -712,7 +714,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -712,7 +714,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
nonlocal DONE nonlocal DONE
try: try:
yield 1 yield 1
1 / 0 1 / ZERO
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01, loop=self.loop)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01, loop=self.loop)
...@@ -905,7 +907,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -905,7 +907,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def sleep_n_crash(delay): async def sleep_n_crash(delay):
await asyncio.sleep(delay, loop=self.loop) await asyncio.sleep(delay, loop=self.loop)
1 / 0 1 / ZERO
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
...@@ -1184,7 +1186,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1184,7 +1186,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
await asyncio.sleep(timeout, loop=self.loop) await asyncio.sleep(timeout, loop=self.loop)
yield 1 yield 1
finally: finally:
1 / 0 1 / ZERO
async def wait(): async def wait():
async for _ in waiter(1): async for _ in waiter(1):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment