Show More
@@ -1,10 +1,12 b'' | |||
|
1 | import types | |
|
2 | import sys | |
|
3 | 1 |
|
|
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: |
General Comments 0
You need to be logged in to leave comments.
Login now