Skip to content

Commit 1ee8e03

Browse files
committed
Add test_async.py
1 parent 300b89d commit 1ee8e03

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
PYTHON ?= python
2+
PY_34 ?= $(shell ! python -c \
3+
'import sys; print((3, 4) < sys.version_info)')
24

3-
.PHONY: test
5+
.PHONY: test develop
46

57
test:
68
$(PYTHON) -m memory_profiler test/test_func.py
@@ -18,6 +20,9 @@ test:
1820
$(PYTHON) test/test_exception.py
1921
$(PYTHON) test/test_exit_code.py
2022
$(PYTHON) test/test_mprof.py
23+
if [ $(PY_34) = True ]; then \
24+
$(PYTHON) test/test_aio_34.py; \
25+
fi
2126

2227
develop:
2328
pip install -e .

test/test_async.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import asyncio
2+
3+
from memory_profiler import profile
4+
5+
6+
@profile
7+
@asyncio.coroutine
8+
def my_func():
9+
a = [1] * (10 ** 6)
10+
b = [2] * (2 * 10 ** 7)
11+
print('kek')
12+
yield from asyncio.sleep(1e-2)
13+
del b
14+
15+
16+
if __name__ == '__main__':
17+
loop = asyncio.get_event_loop()
18+
loop.run_until_complete(my_func())

0 commit comments

Comments
 (0)