-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TEST] Move pytest config to pyproject.toml
- Loading branch information
Showing
4 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
import asyncio | ||
from typing import List | ||
|
||
import pytest | ||
|
||
|
||
@pytest.hookimpl(tryfirst=True, hookwrapper=True) | ||
def pytest_terminal_summary(terminalreporter): | ||
yield | ||
|
||
xfailed: List[pytest.TestReport] = terminalreporter.stats.get("xfailed", []) | ||
if xfailed: | ||
terminalreporter.write_sep("=", "XFAIL summary info", cyan=True, bold=True) | ||
|
||
for rep in xfailed: | ||
reason = getattr(rep, "wasxfail", "") | ||
terminalreporter.write("XFAIL", yellow=True) | ||
terminalreporter.write(f" {rep.nodeid} - {reason}\n") | ||
|
||
rep.longrepr.toterminal(terminalreporter._tw) | ||
terminalreporter.line("") | ||
|
||
|
||
# cannot put in boilerplate because pytest is a mess | ||
@pytest.fixture(scope="session") | ||
def event_loop(): | ||
loop = asyncio.get_event_loop() | ||
yield loop | ||
|
||
# clean any remaining task to avoid the warning about pending tasks | ||
tasks = asyncio.Task.all_tasks(loop) if hasattr(asyncio.Task, "all_tasks") else asyncio.all_tasks(loop) | ||
for task in tasks: | ||
# print(f"Cancelling task {task}") | ||
task.cancel() | ||
|
||
loop.close() |
This file was deleted.
Oops, something went wrong.