Some Python algorithm tests are hiding bugs #34570
Labels
ISIS Team: Core
Issue and pull requests managed by the Core subteam at ISIS
Maintenance
Unassigned issues to be addressed in the next maintenance period.
I have run into some issue which haven't been picked up in tests which should have.
When a
PythonAlgorithm
is called it runsvalidateInputs
which returns a dictionary of issues used to tell the user which inputs are wrong and why. It seems that when this dictionary is not empty some kind ofRuntimeError
is raised, opening a message box.The problem is that in many tests for these algorithms, when testing that inputs are validated correctly the test simply excepts a
RuntimeError
. This error could then be something like a typo or really any of kind of exception raised by the code and the test will still pass because it does not query this exception. Exceptions like this will often result in crashes.For example:
RuntimeError
Describe the outcome that is desired.
Testing validation of test inputs should not hide all
RuntimeError
raises and only pass if the exact correct warning is raised.Describe any solutions you are considering
Me and @thomashampson thought of two approaches.
Additional context
Some tests are testing in a safer way. For example
MatchPeaksTest.py
which querys the exception string (although only checks that is an exception raised byvalidateInputs
and not what it is specifically about).Files looked into
Part1 #35289
AbinsAdvancedParametersTest.py
AbinsBasicTest.py
ApplyDetectorScanEffCorrTest.py
BinWidthAtXTest.py
CalculateEfficiencyCorrectionTest.py
CalculateSampleTransmissionTest.py
ComputeIncoherentDOSTest.py
CreateCacheFilenameTest.py
CylinderPaalmanPingsCorrection2Test.py
DNSComputeDetEffCorrCoefsTest.py
DNSFlippingRatioCorrTest.py
DNSMergeRunsTest.py
Part 2 #35297
EnggCalibrateFullTest.py
*EnggCalibrateTest.py
*EnggEstimateFocussedBackgroundTest.py
EnggFitPeaksTest.py
*EnggFitTOFFromPeaksTest.py
*EnggFocusTest.py
EnggVanadiumCorrectionsTest.py
*ExtractMonitorsTest.py
FindGlobalBMatrixTest.py
FindGoniometerFromUBTest.py
FitGaussianTest.py
GenerateLogbookTest.py
HB3AAdjustSampleNormTest.py
IndirectTransmissionTest.py
LeadPressureCalcTest.py
*LoadAndMergeTest.py
*LoadCIFTest.py
LoadDNSLegacyTest.py
LoadGundrumOutputTest.py
LoadLampTest.py
LoadNMoldyn3AsciiTest.py
LoadNMoldyn4AsciiDTest.py
LoadNMoldyn4AsciiTest.py
Part 3 #35306
MatchPeaksTest.py
MatchSpectraTest.py
MeanTest.py
MedianBinWidthTest.py
NMoldyn4InterpolationTest.py
NormaliseSpectraTest.py
PeakMatchingTest.py
*PoldiCreatePeaksFromFileTest.py
*PoldiMergeTest.py
ReflectometryReductionOneLiveDataTest.py
RetrieveRunInfoTest.py
SANSWideAngleCorrectionTest.py
SaveReflectionsTest.py
SaveYDATest.py
SelectNexusFilesByMetadataTest.py
SetSampleFromLogsTest.py
SymmetriseTest.py
TOFTOFCropWorksapceTest.py
TOFTOFMergeRunsTest.py
VersuvioPeakPredictionTest.py
VersuvioPreFitTest.py
VersuvioResolutionTest.py
VersuvioThicknessTest.py
VersuvioTOFFitTest.py
WorksapceAlgorithms
Part 4 #35326AddSampleLogMultipleTest.py
ApplyPaalmanPingsCorrectionTest.py
*BayesStretchTest.py
D7YIGPositionCalibrationTest.py
DetectorFloodWeightingTest.py
DirectILLReductionTest.py
FindPeakAutomaticTest.py
FitGaussianPeaksTest.py
FlatPlatePaalmanPingsCorrectionTest.py
IndirectReplaceFitResultTest.py
IndirectSampleChangerTest.py
IqtFitMultipleTest.py
IqtFitSequentialTest.py
ISISIndirectDiffractionReductionTest.py
ISISIndirectEnergyTransferTest.py
ISISIndirectEnergyTransferWrapperTest.py
Part 5 #35330
MatchAndMergeWorkspacesTest.py
MSDFitTest.py
OSIRISDiffractionReductionTest.py
ReflectometryILL_commonTest.py
ResNorm2Test.py
SANSDarkRunBackgroundCorrectionTest.py
SANSFitShiftScaleTest.py
SANSILLAutoProcessTest.py
SANSILLMultiProcessTest.py
SANSILLReduction2Test.py
SANSStitchTest.py
*SaveVulcanGSSTest.py
*SimpleShapeDiscussInelasticTest.py
SimpleShapeMonteCarloAbsorptionTest.py
SimulatedDensityOfStatesTest.py
TimeSliceTest.py
TOSCABankCorrectionTest.py
TotScateCalculateSelfScatteringTest.py
The text was updated successfully, but these errors were encountered: