Addon Manager: Improve unit tests for utlility
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import os
|
||||
import tempfile
|
||||
@@ -55,7 +56,7 @@ class TestWorkersStartup(unittest.TestCase):
|
||||
|
||||
# Populated when the addon list is created in the first test
|
||||
self.package_cache = {}
|
||||
self.macro_cache = {}
|
||||
self.macro_cache = []
|
||||
|
||||
self.package_cache_file = tempfile.NamedTemporaryFile(mode='w', encoding="utf-8", delete=False)
|
||||
self.macro_cache_file = tempfile.NamedTemporaryFile(mode='w', encoding="utf-8", delete=False)
|
||||
|
||||
@@ -53,6 +53,7 @@ class TestWorkersUtility(unittest.TestCase):
|
||||
worker.start()
|
||||
while worker.isRunning():
|
||||
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 50)
|
||||
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents)
|
||||
self.assertEqual(self.last_result,"SUCCESS")
|
||||
|
||||
def test_connection_checker_thread_interrupt(self):
|
||||
@@ -64,6 +65,7 @@ class TestWorkersUtility(unittest.TestCase):
|
||||
worker.requestInterruption()
|
||||
while worker.isRunning():
|
||||
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 50)
|
||||
QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents)
|
||||
self.assertIsNone(self.last_result, "Requesting interruption of thread failed to interrupt")
|
||||
|
||||
def connection_succeeded(self):
|
||||
|
||||
@@ -45,6 +45,7 @@ class ConnectionChecker(QtCore.QThread):
|
||||
FreeCAD.Console.PrintLog("Checking network connection...\n")
|
||||
result = self.check_network_connection()
|
||||
if QtCore.QThread.currentThread().isInterruptionRequested():
|
||||
FreeCAD.Console.PrintLog("Connection check cancelled\n")
|
||||
return
|
||||
if not result:
|
||||
self.failure.emit(
|
||||
|
||||
Reference in New Issue
Block a user