##// END OF EJS Templates
make sure to run async tests...
Min RK -
Show More
@@ -1,10 +1,12 b''
1 import types
2 import sys
3 1 import builtins
2 import inspect
4 3 import os
5 import pytest
6 4 import pathlib
7 5 import shutil
6 import sys
7 import types
8
9 import pytest
8 10
9 11 # Must register before it gets imported
10 12 pytest.register_assert_rewrite("IPython.testing.tools")
@@ -12,6 +14,19 b' pytest.register_assert_rewrite("IPython.testing.tools")'
12 14 from .testing import tools
13 15
14 16
17 def pytest_collection_modifyitems(items):
18 """This function is automatically run by pytest passing all collected test
19 functions.
20
21 We use it to add asyncio marker to all async tests and assert we don't use
22 test functions that are async generators which wouldn't make sense.
23 """
24 for item in items:
25 if inspect.iscoroutinefunction(item.obj):
26 item.add_marker("asyncio")
27 assert not inspect.isasyncgenfunction(item.obj)
28
29
15 30 def get_ipython():
16 31 from .terminal.interactiveshell import TerminalInteractiveShell
17 32 if TerminalInteractiveShell._instance:
@@ -32,7 +47,7 b' def work_path():'
32 47 if path.exists():
33 48 raise ValueError('IPython dir temporary path already exists ! Did previous test run exit successfully ?')
34 49 path.mkdir()
35 yield
50 yield
36 51 shutil.rmtree(str(path.resolve()))
37 52
38 53
@@ -150,6 +150,7 b' extras_require = dict('
150 150 doc=["Sphinx>=1.3"],
151 151 test=[
152 152 "pytest",
153 "pytest-asyncio",
153 154 "testpath",
154 155 "pygments",
155 156 ],
General Comments 0
You need to be logged in to leave comments. Login now