changeset 8533:67ed90055e47

test: handle failing email signature removal test differently The comment for the test is: # This fails because the sig isn't removed (we currently remove the # sig only if the delimiter is the first line in a section) Originally the test was decorated so it didn't run at all and reported PASSED. The decorator also returned the value 0. This caused a deprecation warning: test/test_mailgw.py::MailgwTestCase::testEmailQuotingRemove3 /usr/lib/python3.12/unittest/case.py:690: DeprecationWarning: It is deprecated to return a value that is not None from a test case [...] Better to handle it using pytest xfail so if we start stripping the signature we get a failure. This does mean the tests get an xfail registered, but I am ok with that. I added "OK" to the reason to indicate it was expected.
author John Rouillard <rouilj@ieee.org>
date Wed, 18 Mar 2026 11:11:03 -0400
parents bedf11bc0dd5
children 1f8492d68aca
files test/test_mailgw.py
diffstat 1 files changed, 1 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_mailgw.py	Wed Mar 18 10:55:17 2026 -0400
+++ b/test/test_mailgw.py	Wed Mar 18 11:11:03 2026 -0400
@@ -60,12 +60,6 @@
 from roundup.test import memorydb
 from .cmp_helper import StringFragmentCmpHelper
 
-def expectedFailure(method):
-    """ For marking a failing test.
-        This will *not* run the test and return success instead.
-    """
-    return lambda x: 0
-
 
 def get_body(message):
     if not message.is_multipart():
@@ -3706,7 +3700,7 @@
 
     # This fails because the sig isn't removed (we currently remove the
     # sig only if the delimiter is the first line in a section)
-    @expectedFailure
+    @pytest.mark.xfail(reason="OK: sig not removed - delim not first section line")
     def testEmailQuotingRemove3(self):
         self.instance.config.EMAIL_KEEP_QUOTED_TEXT = 'yes'
         self.innerTestQuoting(self.thirdquotingtest,

Roundup Issue Tracker: http://roundup-tracker.org/