Commit 9af95d64 authored by payno's avatar payno

[gui][datavalidor] fix unit tests.

parent 8424f679
......@@ -108,6 +108,12 @@ class DataValidatorOW(widget.OWWidget):
self._widget.sigScanReady.connect(self._scanReadyEmitted)
self._widget._centralWidget.sigConfigChanged.connect(self._updateSettings)
def close(self):
self._widget.setAttribute(qt.Qt.WA_DeleteOnClose)
self._widget.close()
self._widget = None
widget.OWWidget.close(self)
@Inputs.data_in
def addScan(self, scan):
if scan is None:
......
......@@ -148,8 +148,9 @@ class BaseTestValidation(unittest.TestCase):
shutil.rmtree(cls.rootdir)
def tearDown(self):
self.scanValidator.setAttribute(qt.Qt.WA_DeleteOnClose)
self.scanValidator.close()
del self.scanValidator
self.scanValidator = None
unittest.TestCase.tearDown(self)
def setUp(self):
......@@ -160,14 +161,9 @@ class BaseTestValidation(unittest.TestCase):
class TestValidation(BaseTestValidation):
"""Test validation for the latest data validation widget"""
class _DataValidatorWidgetPatched(DataValidatorOW):
"""A DataValidatorOW without the Orange send signal process"""
scanReady = qt.Signal(TomwerScanBase)
_warnValManualShow = True
def setUp(self):
BaseTestValidation.setUp(self)
self.scanValidator = TestValidation._DataValidatorWidgetPatched()
self.scanValidator = DataValidatorOW()
self.scanValidator._warnValManualShow = True
self.scanValidator._widget.sigScanReady.connect(self.validationReceiver.count)
self.validationReceiver.counter = 0
......
......@@ -107,6 +107,12 @@ class DataValidator(qt.QMainWindow, BaseDataValidator):
_controlButtons.sigChangeReconstructionParametersScan.connect(self.changeReconsParamCurrentScan)
_controlButtons.toggled.connect(self.setManualValidation)
def close(self) -> bool:
self._centralWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
self._centralWidget.close()
self._centralWidget = None
qt.QMainWindow.close(self)
def addScan(self, scan):
"""
......
......@@ -30,6 +30,7 @@ __date__ = "29/05/2017"
import unittest
from . import test_datalist
from . import test_datalistener
from . import test_datavalidator
from . import test_datawatcher
from . import test_h5editor
from . import test_inputwidget
......@@ -42,6 +43,7 @@ def suite():
test_suite.addTests([
test_datalist.suite(),
test_datalistener.suite(),
test_datavalidator.suite(),
test_datawatcher.suite(),
test_h5editor.suite(),
test_inputwidget.suite(),
......
......@@ -81,6 +81,12 @@ class DataViewer(qt.QMainWindow):
self._controls.sigDisplayModeChanged.connect(self._updateDisplay)
self._controls.sigDisplayModeChanged.connect(self._reportSettingsUpdate)
def close(self):
self._viewer.setAttribute(qt.Qt.WA_DeleteOnClose)
self._viewer.close()
self._viewer = None
qt.QMainWindow.close(self)
def _urlIndexDelayed(self, *args, **kwargs):
self._viewer.setCurrentUrlIndex(args[0][0])
......
......@@ -29,11 +29,13 @@ __date__ = "29/05/2017"
import unittest
from . import test_sinogramviewer
from . import test_dataviewer
def suite():
test_suite = unittest.TestSuite()
test_suite.addTests([
test_dataviewer.suite(),
test_sinogramviewer.suite(),
])
return test_suite
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment