import sys
import unittest

from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtTest import QTest
from PyQt5.QtCore import *
from unittest.mock import MagicMock

# Local
from sas.qtgui.Utilities.GuiUtils import Communicate
from sas.qtgui.UnitTesting.TestUtils import *

if not QApplication.instance():
    app = QApplication(sys.argv)

class TestUtilsTest(unittest.TestCase):
    '''Test TestUtils'''

    def testQtSignalSpy(self):
        '''Create the Spy the correct way'''
        test_string = 'my precious'

        def signalReceived(signal):
            # Test the signal callback
            assert signal == test_string

        communicator = Communicate()
        communicator.statusBarUpdateSignal.connect(signalReceived)

        # Define the signal spy for testing
        widget = QWidget()
        spy = QtSignalSpy(widget, communicator.statusBarUpdateSignal)

        # Emit a signal
        communicator.statusBarUpdateSignal.emit(test_string)

        # Was the signal caught by the signal spy?
        assert spy.count() == 1

if __name__ == "__main__":
    unittest.main()

@@ -7,24 +7,8 @@
  sys
-%0Aimport unittest
 %0A%0Afr
@@ -268,112 +268,27 @@
  *%0A%0A
-if not QApplication.instance():%0A    app = QApplication(sys.argv)%0A%0Aclass TestUtilsTest(unittest.TestCase)
+class TestUtilsTest
 :%0A  
@@ -339,16 +339,22 @@
 Spy(self
+, qapp
 ):%0A     
@@ -967,52 +967,4 @@
 = 1%0A
-%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A

Change to pytest fixtures TestUtilsTest.py