Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

emollier
Copy link
Contributor

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.

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.

[Debian bugs #1063943]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063943
[then #1071794]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071794

Signed-off-by: Étienne Mollier <emollier@debian.org>
@moloney moloney merged commit 3c7ee96 into moloney:master Jun 5, 2024
@moloney
Copy link
Owner

moloney commented Jun 5, 2024

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants