Closed samtygier-stfc closed 1 month ago
Note: Upgrading to python 3.11
introduces the following test failures
============================================================ FAILURES =============================================================
_____________________________________________ CommandLineArgumentsTest.test_tracking ______________________________________________
[gw6] win32 -- Python 3.11.9 C:\Users\ddb29996\AppData\Local\miniforge3\envs\mantidimaging-dev\python.exe
self = <mantidimaging.core.utility.test.leak_tracker_test.CommandLineArgumentsTest testMethod=test_tracking>
def test_tracking(self):
self.assertEqual(self.leak_tracker.count(), 0)
ob1 = ExampleObject()
self.leak_tracker.add(ob1, "created_in_test_tracking")
container = ExampleContainer(ob1) # noqa: F841
self.assertEqual(self.leak_tracker.count(), 1)
del ob1
self.assertEqual(self.leak_tracker.count(), 1)
def check_output(message, **kwargs):
track_output = StringIO()
self.leak_tracker.pretty_print(output=track_output, **kwargs)
track_output_value = track_output.getvalue()
self.assertIn(message, track_output_value)
# check that the object type and message are in the output
check_output("leak_tracker_test.ExampleObject")
check_output("created_in_test_tracking")
# Check that this file and the line of code are listed in the output
check_output(__file__, debug_init=True)
check_output('self.leak_tracker.add(ob1, "created_in_test_tracking")', debug_init=True)
# Check that container holding the reference is listed in the output
check_output("leak_tracker_test.ExampleContainer", debug_owners=True)
> check_output("held_reference", debug_owners=True)
mantidimaging\core\utility\test\leak_tracker_test.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mantidimaging\core\utility\test\leak_tracker_test.py:75: in check_output
self.assertIn(message, track_output_value)
E AssertionError: 'held_reference' not found in " Object: <class 'mantidimaging.core.utility.test.leak_tracker_test.ExampleObject'> pyid=2602674833232 \n item_info.msg='created_in_test_tracking'\n Ownership:\n\t <class 'mantidimaging.core.utility.test.leak_tracker_test.ExampleContainer'> pyid=2602674833488 \n\t <class 'mantidimaging.core.utility.test.leak_tracker_test.ExampleObject'> pyid=2602674833232 \n\n\n"
_______________________________________________ ImageStackTest.test_cant_change_id ________________________________________________
[gw10] win32 -- Python 3.11.9 C:\Users\ddb29996\AppData\Local\miniforge3\envs\mantidimaging-dev\python.exe
AttributeError: property 'id' of 'ImageStack' object has no setter
During handling of the above exception, another exception occurred:
self = <mantidimaging.core.data.test.image_stack_test.ImageStackTest testMethod=test_cant_change_id>
def test_cant_change_id(self):
> with self.assertRaisesRegex(Exception, "can't set attribute"):
E AssertionError: "can't set attribute" does not match "property 'id' of 'ImageStack' object has no setter"
mantidimaging\core\data\test\image_stack_test.py:247: AssertionError
__________________________________________ StrictDatasetTest.test_cant_change_dataset_id __________________________________________
[gw13] win32 -- Python 3.11.9 C:\Users\ddb29996\AppData\Local\miniforge3\envs\mantidimaging-dev\python.exe
AttributeError: property 'id' of 'StrictDataset' object has no setter
During handling of the above exception, another exception occurred:
self = <mantidimaging.gui.windows.main.test.strictdataset_test.StrictDatasetTest testMethod=test_cant_change_dataset_id>
def test_cant_change_dataset_id(self):
> with self.assertRaisesRegex(Exception, "set attribute"):
E AssertionError: "set attribute" does not match "property 'id' of 'StrictDataset' object has no setter"
mantidimaging\gui\windows\main\test\strictdataset_test.py:53: AssertionError
Desired Behaviour
Update to the latest python version