forked from supriya-project/supriya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
33 lines (25 loc) · 797 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import asyncio
import pytest
import pytest_asyncio
import supriya
from supriya import scsynth
from supriya.contexts.realtime import BaseServer
@pytest.fixture(autouse=True)
def add_libraries(doctest_namespace):
doctest_namespace["supriya"] = supriya
@pytest.fixture(autouse=True, scope="session")
def shutdown_scsynth():
scsynth.kill()
yield
scsynth.kill()
@pytest_asyncio.fixture(autouse=True)
async def shutdown_realtime_contexts(shutdown_scsynth, event_loop):
for context in tuple(BaseServer._contexts):
result = context._shutdown()
if asyncio.iscoroutine(result):
await result
yield
for context in tuple(BaseServer._contexts):
result = context._shutdown()
if asyncio.iscoroutine(result):
await result