Fix broken tests.
parent
6a6259fa83
commit
410b4ed952
|
@ -22,7 +22,7 @@
|
|||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Any, Dict, Optional, Set, Tuple
|
||||
from typing import Any, Optional, Set, Tuple
|
||||
|
||||
from noisicaa import core
|
||||
# pylint/mypy don't understand capnp modules.
|
||||
|
|
|
@ -166,7 +166,8 @@ class AudioProcClientTest(
|
|||
for node_state_change in msg.node_state_changes:
|
||||
if (node_state_change.realm == 'root'
|
||||
and node_state_change.node_id == 'test'
|
||||
and node_state_change.state == engine_notification_pb2.NodeStateChange.BROKEN):
|
||||
and (node_state_change.state
|
||||
== engine_notification_pb2.NodeStateChange.BROKEN)):
|
||||
is_broken.set()
|
||||
client.engine_notifications.add(engine_notification)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import logging
|
|||
import sys
|
||||
import time
|
||||
import uuid
|
||||
from typing import cast, Any, Optional, Dict, List, Set, Tuple
|
||||
from typing import cast, Any, Optional, Dict, Set, Tuple
|
||||
|
||||
import posix_ipc
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Session(core.CallbackSessionMixin, core.SessionBase):
|
|||
self.__notification_available = None # type: asyncio.Event
|
||||
self.__pending_notification = engine_notification_pb2.EngineNotification()
|
||||
|
||||
async def setup(self):
|
||||
async def setup(self) -> None:
|
||||
await super().setup()
|
||||
|
||||
self.__shutdown = False
|
||||
|
@ -65,7 +65,7 @@ class Session(core.CallbackSessionMixin, core.SessionBase):
|
|||
self.__notification_pusher_task = self.event_loop.create_task(
|
||||
self.__notification_pusher())
|
||||
|
||||
async def cleanup(self):
|
||||
async def cleanup(self) -> None:
|
||||
if self.__notification_pusher_task is not None:
|
||||
self.__shutdown = True
|
||||
self.__notification_available.set()
|
||||
|
@ -75,7 +75,7 @@ class Session(core.CallbackSessionMixin, core.SessionBase):
|
|||
|
||||
await super().cleanup()
|
||||
|
||||
async def __notification_pusher(self):
|
||||
async def __notification_pusher(self) -> None:
|
||||
while True:
|
||||
await self.__notification_available.wait()
|
||||
self.__notification_available.clear()
|
||||
|
|
|
@ -25,7 +25,6 @@ import asyncio
|
|||
import logging
|
||||
|
||||
from noisidev import unittest
|
||||
from noisicaa import core
|
||||
from noisicaa import audioproc
|
||||
from noisicaa.core import ipc
|
||||
from noisicaa.constants import TEST_OPTS
|
||||
|
@ -39,8 +38,6 @@ logger = logging.getLogger(__name__)
|
|||
class MockAudioProcClient(audioproc.AudioProcClientBase): # pylint: disable=abstract-method
|
||||
def __init__(self):
|
||||
super().__init__(None, None)
|
||||
self.player_state_changed = core.Callback()
|
||||
self.pipeline_status = core.Callback()
|
||||
|
||||
async def setup(self):
|
||||
pass
|
||||
|
|
|
@ -56,7 +56,7 @@ class Session(core.CallbackSessionMixin, core.SessionBase):
|
|||
|
||||
self.session_data = {} # type: Dict[str, Any]
|
||||
self.session_data_path = None # type: str
|
||||
self.__players = {} # type: Dict[str, Tuple[core.Listener, player_lib.Player]]
|
||||
self.__players = {} # type: Dict[str, player_lib.Player]
|
||||
|
||||
async def cleanup(self) -> None:
|
||||
await self.clear_players()
|
||||
|
|
|
@ -26,7 +26,7 @@ import pprint
|
|||
import sys
|
||||
import traceback
|
||||
import types
|
||||
from typing import Any, Optional, Callable, Sequence, Dict, Type
|
||||
from typing import Any, Optional, Callable, Sequence, Type
|
||||
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5 import QtWidgets
|
||||
|
@ -310,6 +310,7 @@ class EditorApp(ui_base.AbstractEditorApp):
|
|||
def __handleEngineNotification(self, msg: audioproc.EngineNotification) -> None:
|
||||
pass
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
# def onPlayerStatus(self, player_state: audioproc.PlayerState):
|
||||
# if pipeline_disabled:
|
||||
# dialog = QtWidgets.QMessageBox(self)
|
||||
|
@ -340,6 +341,7 @@ class EditorApp(ui_base.AbstractEditorApp):
|
|||
# elif dialog.clickedButton() == undo_and_restart_button:
|
||||
# await self.project_client.undo()
|
||||
# await self.project_client.restart_player_pipeline(self.__player_id)
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
def setClipboardContent(self, content: Any) -> None:
|
||||
logger.info(
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
import logging
|
||||
import textwrap
|
||||
import typing
|
||||
from typing import cast, Any, Optional, Iterator
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
|
@ -41,6 +42,9 @@ from . import qprogressindicator
|
|||
from . import project_registry
|
||||
from . import load_history
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from noisicaa import core
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -369,7 +373,7 @@ class EditorWindow(ui_base.AbstractEditorWindow):
|
|||
|
||||
self._settings_dialog.storeState()
|
||||
|
||||
def __engineStateChanged(self, engine_state: audioproc.EngineStateChange):
|
||||
def __engineStateChanged(self, engine_state: audioproc.EngineStateChange) -> None:
|
||||
show_status, show_load = False, False
|
||||
if engine_state.state == audioproc.EngineStateChange.SETUP:
|
||||
self.pipeline_status.setText("Starting engine...")
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
import functools
|
||||
import logging
|
||||
import typing
|
||||
from typing import cast, Any, Optional, Dict, List
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
|
@ -39,6 +40,9 @@ from noisicaa.ui import ui_base
|
|||
from . import node_widget
|
||||
from . import plugin_ui
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from noisicaa import core
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
import math
|
||||
import time
|
||||
import typing
|
||||
from typing import Any, List
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
|
@ -33,6 +34,9 @@ from PyQt5 import QtWidgets
|
|||
from noisicaa.core import perf_stats_capnp # type: ignore # pylint: disable=no-name-in-module
|
||||
from . import ui_base
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from noisicaa import core
|
||||
|
||||
|
||||
class PipelinePerfMonitor(ui_base.AbstractPipelinePerfMonitor):
|
||||
visibilityChanged = QtCore.pyqtSignal(bool)
|
||||
|
@ -84,7 +88,7 @@ class PipelinePerfMonitor(ui_base.AbstractPipelinePerfMonitor):
|
|||
self.restoreGeometry(
|
||||
self.app.settings.value('dialog/pipeline_perf_monitor/geometry', b''))
|
||||
|
||||
self.__perf_stats_listener = None
|
||||
self.__perf_stats_listener = None # type: core.Listener[perf_stats_capnp.PerfStats]
|
||||
|
||||
def storeState(self) -> None:
|
||||
s = self.app.settings
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
import logging
|
||||
import uuid
|
||||
from typing import Any, Optional, Tuple
|
||||
from typing import Any, Tuple
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5 import QtCore
|
||||
|
|
|
@ -32,6 +32,7 @@ import asynctest
|
|||
|
||||
from noisicaa.constants import TEST_OPTS
|
||||
from noisicaa import runtime_settings as runtime_settings_lib
|
||||
from noisicaa import audioproc
|
||||
from noisicaa import core
|
||||
from noisicaa import music
|
||||
from noisicaa import devices
|
||||
|
@ -52,6 +53,10 @@ class TestContext(object):
|
|||
def app(self):
|
||||
return self.__testcase.app
|
||||
|
||||
@property
|
||||
def audioproc_client(self):
|
||||
return self.__testcase.app.audioproc_client
|
||||
|
||||
@property
|
||||
def window(self):
|
||||
return self.__testcase.window
|
||||
|
@ -105,6 +110,12 @@ class TestContext(object):
|
|||
raise NotImplementedError
|
||||
|
||||
|
||||
class MockAudioProcClient(audioproc.AudioProcClientBase): # pylint: disable=abstract-method
|
||||
def __init__(self):
|
||||
super().__init__(None, None)
|
||||
self.node_state_changed = core.CallbackMap[str, audioproc.NodeStateChange]()
|
||||
|
||||
|
||||
class MockSequencer(object):
|
||||
def __init__(self):
|
||||
self._ports = [] # type: List[devices.PortInfo]
|
||||
|
@ -225,6 +236,7 @@ class UITestCase(unittest_mixins.ProcessManagerMixin, qttest.QtTestCase):
|
|||
self.app.settings = MockSettings()
|
||||
self.app.midi_hub = self.midi_hub
|
||||
self.app.node_db = self.node_db_client
|
||||
self.app.audioproc_client = MockAudioProcClient()
|
||||
|
||||
self.session_data = {} # type: Dict[str, Any]
|
||||
|
||||
|
|
Loading…
Reference in New Issue