QuantitativeReporting icon indicating copy to clipboard operation
QuantitativeReporting copied to clipboard

Fix py_QuantitativeReportingTests

Open jcfr opened this issue 8 years ago • 3 comments

$ ctest -V

    Start 1: py_QuantitativeReportingTests

1: Test command: /home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/Slicer "--no-splash" "--testing" "--launcher-additional-settings" "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/AdditionalLauncherSettings.ini" "--additional-module-paths" "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-scripted-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/SlicerDevelopmentToolbox-build/./lib/Slicer-4.9/qt-loadable-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/SlicerDevelopmentToolbox-build/./lib/Slicer-4.9/cli-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/PETDICOMExtension-build/./lib/Slicer-4.9/qt-loadable-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/PETDICOMExtension-build/./lib/Slicer-4.9/cli-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/DCMQI-build/dcmqi-build/dcmqi-build/bin" "/home/kitware/Dashboards/Nightly/S-0-E-b/SlicerDevelopmentToolbox-build/./lib/Slicer-4.9/qt-scripted-modules" "--additional-module-paths" "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-scripted-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/cli-modules" "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-loadable-modules" "--python-code" "import slicer.testing; slicer.testing.runUnitTest(['/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/Testing', '/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing'], 'QuantitativeReportingTests')"
1: Test timeout computed to be: 1500
1: Number of registered modules: 145 
1: SystemError: /home/kitware/Dashboards/Nightly/Slicer-0-build/Python-2.7.13/Objects/classobject.c:521: bad argument to internal function
1: qSlicerPythonCppAPI::instantiateClass  - [ "__init__" ] - Failed to instantiate scripted pythonqt class "__init__" 0x7f08d4ab9810 
1: Fail to instantiate module  "__init__" 
1: Number of instantiated modules: 144 
1: Number of loaded modules: 144 
1: Switch to module:  "Welcome" 
1: -------------------------------------------
1: path: ['/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/Testing', '/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing']
1: testname: QuantitativeReportingTests
1: -------------------------------------------
1: Closing the scene
1: Starting test_create_report
1: Switch to module:  "QuantitativeReporting" 
1: Loading testdata
1: test_create_report (QuantitativeReportingTests.QuantitativeReportingTest) ... ERROR
1: Closing the scene
1: test_import_labelmap (QuantitativeReportingTests.QuantitativeReportingTest) ... Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/lib/Slicer-4.9/qt-scripted-modules/SegmentEditor.py", line 143, in onSceneEndClose
1:     if self.parent.isEntered:
1: AttributeError: QGroupBox has no attribute named 'isEntered'
1: Starting test_import_labelmap
1: Loading testdata
1: ERROR
1: Closing the scene
1: test_import_segmentation (QuantitativeReportingTests.QuantitativeReportingTest) ... Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/lib/Slicer-4.9/qt-scripted-modules/SegmentEditor.py", line 143, in onSceneEndClose
1:     if self.parent.isEntered:
1: AttributeError: QGroupBox has no attribute named 'isEntered'
1: Starting test_import_segmentation
1: Loading testdata
1: ERROR
1: Closing the scene
1: test_read_report (QuantitativeReportingTests.QuantitativeReportingTest) ... Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/lib/Slicer-4.9/qt-scripted-modules/SegmentEditor.py", line 143, in onSceneEndClose
1:     if self.parent.isEntered:
1: AttributeError: QGroupBox has no attribute named 'isEntered'
1: Starting test_read_report
1: ERROR
1: runTest (slicer.ScriptedLoadableModule.ScriptedLoadableModuleTest) ... No test is defined in ScriptedLoadableModuleTest
1: ok
1: 
1: ======================================================================
1: ERROR: test_create_report (QuantitativeReportingTests.QuantitativeReportingTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 186, in test_create_report
1:     self.loadTestVolume()
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 119, in loadTestVolume
1:     qrWidget.loadTestData(self.collection, imageDataType="volume", uid=self.data["volume"]["uid"])
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-scripted-modules/QuantitativeReporting.py", line 197, in loadTestData
1:     if not len(slicer.dicomDatabase.filesForSeries(uid)):
1: AttributeError: 'NoneType' object has no attribute 'filesForSeries'
1: 
1: ======================================================================
1: ERROR: test_import_labelmap (QuantitativeReportingTests.QuantitativeReportingTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 229, in test_import_labelmap
1:     self.loadTestVolume()
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 119, in loadTestVolume
1:     qrWidget.loadTestData(self.collection, imageDataType="volume", uid=self.data["volume"]["uid"])
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-scripted-modules/QuantitativeReporting.py", line 197, in loadTestData
1:     if not len(slicer.dicomDatabase.filesForSeries(uid)):
1: AttributeError: 'NoneType' object has no attribute 'filesForSeries'
1: 
1: ======================================================================
1: ERROR: test_import_segmentation (QuantitativeReportingTests.QuantitativeReportingTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 269, in test_import_segmentation
1:     self.loadTestVolume()
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 119, in loadTestVolume
1:     qrWidget.loadTestData(self.collection, imageDataType="volume", uid=self.data["volume"]["uid"])
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting-build/lib/Slicer-4.9/qt-scripted-modules/QuantitativeReporting.py", line 197, in loadTestData
1:     if not len(slicer.dicomDatabase.filesForSeries(uid)):
1: AttributeError: 'NoneType' object has no attribute 'filesForSeries'
1: 
1: ======================================================================
1: ERROR: test_read_report (QuantitativeReportingTests.QuantitativeReportingTest)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 143, in test_read_report
1:     loadTestData()
1:   File "/home/kitware/Dashboards/Nightly/S-0-E-b/QuantitativeReporting/Testing/QuantitativeReportingTests.py", line 135, in loadTestData
1:     if not len(slicer.dicomDatabase.filesForSeries(fileData['uid'])):
1: AttributeError: 'NoneType' object has no attribute 'filesForSeries'
1: 
1: ----------------------------------------------------------------------
1: Ran 5 tests in 11.788s
1: 
1: FAILED (errors=4)
1: Traceback (most recent call last):
1:   File "<string>", line 1, in <module>
1:   File "/home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/bin/Python/slicer/testing.py", line 25, in runUnitTest
1:     exitFailure()
1:   File "/home/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/bin/Python/slicer/testing.py", line 10, in exitFailure
1:     raise Exception(message)
1: Exception
1: Switch to module:  "" 
1/1 Test #1: py_QuantitativeReportingTests ....***Failed   24.00 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =  24.00 sec

The following tests FAILED:
	  1 - py_QuantitativeReportingTests (Failed)
Errors while running CTest

jcfr avatar Feb 06 '18 20:02 jcfr

@jcfr Thanks a lot for the help today.

Is it uncommon to use the slicer.dicomDatabase in tests? If so, are there any examples how to handle such situations?

che85 avatar Feb 06 '18 20:02 che85

You could look into using the context manager DICOMUtils.TemporaryDICOMDatabase(self.dicomDatabaseDir)

For example, see https://github.com/SlicerRt/SlicerRT/commit/eb6d8e7fefa239bce34815243b76651a9d27264d

jcfr avatar Feb 06 '18 21:02 jcfr

https://github.com/SlicerRt/SlicerRT/blob/master/Testing/Python/IGRTWorkflow_SelfTest.py#L125-L146

One more example: https://github.com/SlicerRt/GelDosimetryAnalysis/blob/master/GelDosimetryAnalysis/GelDosimetryAnalysis.py#L2221-L2244

cpinter avatar Feb 06 '18 22:02 cpinter