
import pytest

from UM.Application import Application

class FixtureApplication(Application):
    def __init__(self):
        Application._instance = None
        super().__init__("test", "1.0")

    def functionEvent(self, event):
        pass

    def parseCommandLine(self):
        pass

@pytest.fixture()
def application():
    return FixtureApplication()



import pytest

from UM.Application import Application
from UM.Signal import Signal

class FixtureApplication(Application):
    def __init__(self):
        Application._instance = None
        super().__init__("test", "1.0")
        Signal._app = self

    def functionEvent(self, event):
        event.call()

    def parseCommandLine(self):
        pass

@pytest.fixture()
def application():
    return FixtureApplication()


Make sure to set the test application instance as app for Signals
Make sure to set the test application instance as app for Signals

This makes singals be properly emitted in tests

  
  import pytest
  
  from UM.Application import Application
+ from UM.Signal import Signal
  
  class FixtureApplication(Application):
      def __init__(self):
          Application._instance = None
          super().__init__("test", "1.0")
+         Signal._app = self
  
      def functionEvent(self, event):
-         pass
+         event.call()
  
      def parseCommandLine(self):
          pass
  
  @pytest.fixture()
  def application():
      return FixtureApplication()
  
  
Make sure to set the test application instance as app for Signals
## Code Before:

import pytest

from UM.Application import Application

class FixtureApplication(Application):
    def __init__(self):
        Application._instance = None
        super().__init__("test", "1.0")

    def functionEvent(self, event):
        pass

    def parseCommandLine(self):
        pass

@pytest.fixture()
def application():
    return FixtureApplication()


## Instruction:
Make sure to set the test application instance as app for Signals
## Code After:

import pytest

from UM.Application import Application
from UM.Signal import Signal

class FixtureApplication(Application):
    def __init__(self):
        Application._instance = None
        super().__init__("test", "1.0")
        Signal._app = self

    def functionEvent(self, event):
        event.call()

    def parseCommandLine(self):
        pass

@pytest.fixture()
def application():
    return FixtureApplication()

