tests: Use a real signal for ConfigStub.

This commit is contained in:
Florian Bruhin 2015-08-19 19:37:19 +02:00
parent 3d4fd2652b
commit 1ddd65304a
2 changed files with 6 additions and 4 deletions

View File

@ -147,7 +147,7 @@ def cmdline_test(request):
@pytest.yield_fixture @pytest.yield_fixture
def config_stub(stubs): def config_stub(stubs):
"""Fixture which provides a fake config object.""" """Fixture which provides a fake config object."""
stub = stubs.ConfigStub(signal=stubs.FakeSignal()) stub = stubs.ConfigStub()
objreg.register('config', stub) objreg.register('config', stub)
yield stub yield stub
objreg.delete('config') objreg.delete('config')

View File

@ -274,7 +274,7 @@ class FakeTimer(QObject):
return self._started return self._started
class ConfigStub: class ConfigStub(QObject):
"""Stub for the config module. """Stub for the config module.
@ -282,14 +282,16 @@ class ConfigStub:
data: The config data to return. data: The config data to return.
""" """
def __init__(self, signal): changed = pyqtSignal(str, str)
def __init__(self, parent=None):
"""Constructor. """Constructor.
Args: Args:
signal: The signal to use for self.changed. signal: The signal to use for self.changed.
""" """
super().__init__(parent)
self.data = {} self.data = {}
self.changed = signal
def section(self, name): def section(self, name):
"""Get a section from the config. """Get a section from the config.