##// 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 import builtins
1 import builtins
2 import inspect
4 import os
3 import os
5 import pytest
6 import pathlib
4 import pathlib
7 import shutil
5 import shutil
6 import sys
7 import types
8
9 import pytest
8
10
9 # Must register before it gets imported
11 # Must register before it gets imported
10 pytest.register_assert_rewrite("IPython.testing.tools")
12 pytest.register_assert_rewrite("IPython.testing.tools")
@@ -12,6 +14,19 b' pytest.register_assert_rewrite("IPython.testing.tools")'
12 from .testing import tools
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 def get_ipython():
30 def get_ipython():
16 from .terminal.interactiveshell import TerminalInteractiveShell
31 from .terminal.interactiveshell import TerminalInteractiveShell
17 if TerminalInteractiveShell._instance:
32 if TerminalInteractiveShell._instance:
@@ -32,7 +47,7 b' def work_path():'
32 if path.exists():
47 if path.exists():
33 raise ValueError('IPython dir temporary path already exists ! Did previous test run exit successfully ?')
48 raise ValueError('IPython dir temporary path already exists ! Did previous test run exit successfully ?')
34 path.mkdir()
49 path.mkdir()
35 yield
50 yield
36 shutil.rmtree(str(path.resolve()))
51 shutil.rmtree(str(path.resolve()))
37
52
38
53
@@ -150,6 +150,7 b' extras_require = dict('
150 doc=["Sphinx>=1.3"],
150 doc=["Sphinx>=1.3"],
151 test=[
151 test=[
152 "pytest",
152 "pytest",
153 "pytest-asyncio",
153 "testpath",
154 "testpath",
154 "pygments",
155 "pygments",
155 ],
156 ],
General Comments 0
You need to be logged in to leave comments. Login now