Bugfix nose teardown regression

This commit is contained in:
TJ Bruno 2023-01-26 14:57:39 -08:00
parent ca40380e99
commit 2ee8f79f2e
3 changed files with 5 additions and 3 deletions

View File

@ -348,6 +348,7 @@ Thomas Grainger
Thomas Hisch Thomas Hisch
Tim Hoffmann Tim Hoffmann
Tim Strazny Tim Strazny
TJ Bruno
Tobias Diez Tobias Diez
Tom Dalton Tom Dalton
Tom Viner Tom Viner

View File

@ -0,0 +1 @@
Fix nose teardown fixture regressions.

View File

@ -847,7 +847,7 @@ class Class(PyCollector):
other fixtures (#517). other fixtures (#517).
""" """
setup_class = _get_first_non_fixture_func(self.obj, ("setup_class",)) setup_class = _get_first_non_fixture_func(self.obj, ("setup_class",))
teardown_class = getattr(self.obj, "teardown_class", None) teardown_class = _get_first_non_fixture_func(self.obj, ("teardown_class",))
if setup_class is None and teardown_class is None: if setup_class is None and teardown_class is None:
return return
@ -884,12 +884,12 @@ class Class(PyCollector):
emit_nose_setup_warning = True emit_nose_setup_warning = True
setup_method = _get_first_non_fixture_func(self.obj, (setup_name,)) setup_method = _get_first_non_fixture_func(self.obj, (setup_name,))
teardown_name = "teardown_method" teardown_name = "teardown_method"
teardown_method = getattr(self.obj, teardown_name, None) teardown_method = _get_first_non_fixture_func(self.obj, (teardown_name,))
emit_nose_teardown_warning = False emit_nose_teardown_warning = False
if teardown_method is None and has_nose: if teardown_method is None and has_nose:
teardown_name = "teardown" teardown_name = "teardown"
emit_nose_teardown_warning = True emit_nose_teardown_warning = True
teardown_method = getattr(self.obj, teardown_name, None) teardown_method = _get_first_non_fixture_func(self.obj, (teardown_name,))
if setup_method is None and teardown_method is None: if setup_method is None and teardown_method is None:
return return