moloney / dcmstack

DICOM to Nifti conversion with meta data preservation
Other
72 stars 51 forks source link

t/test_cli.py: port setup/teardown to pytest 8. #87

Closed emollier closed 1 month ago

emollier commented 1 month ago

As pointed out in Debian bugs #1063943 and then #1071794, test/test_cli.py fails with pytest 8 and beyon with the following symptoms:

__________________________ TestDcmstackCli.test_basic __________________________

self = <test.test_cli.TestDcmstackCli object at 0x7f2d3a00eb40>

    def test_basic(self):
>       nii_paths = make_niftis(self.out_dir)
E       AttributeError: 'TestDcmstackCli' object has no attribute 'out_dir'

test/test_cli.py:55: AttributeError
__________________________ TestDcmstackCli.test_embed __________________________

self = <test.test_cli.TestDcmstackCli object at 0x7f2d3c976180>

    def test_embed(self):
>       nii_paths = make_niftis(self.out_dir, ['--embed'])
E       AttributeError: 'TestDcmstackCli' object has no attribute 'out_dir'

test/test_cli.py:59: AttributeError
___________________________ TestNitoolCli.test_basic ___________________________

self = <test.test_cli.TestNitoolCli object at 0x7f2d39f5b1d0>

    def test_basic(self):
>       nii_path = make_niftis(self.out_dir, ['--embed'])[0]
E       AttributeError: 'TestNitoolCli' object has no attribute 'out_dir'

test/test_cli.py:65: AttributeError

This is because pytest 8 deprecated the use of plain setup and teardown, which were compatibility layers to ease the porting effort from Nose. This change ensures methods inheriting from CliTest get set up and teared down properly.

moloney commented 1 month ago

Thanks for the fix!