Cleanups added with addCleanup incorrectly called on subsequent runs when using `trial -u`
Since Trac appears to be not accepting new issues, posting here before I forget: Reproducer: {{{ from twisted.trial.unittest import TestCase class StatefulCleanup: called = False def __call__(self): if self.called: raise AssertionError('Called more than once') self.called = True class TestAddCleanup(TestCase): def setUp(self): self.addCleanup(StatefulCleanup()) def testIt(self): pass }}} If run with trial -u, the AssertionError will be issued. Chris
the ticket was in fact created successfully - it was just the post-ticket hooks that failed https://twistedmatrix.com/trac/ticket/10262
The post-create hook that seems to be failing has to do with SMTP. I can't access the server because I haven't figured out how to set up my SSH keys yet, but if another admin has a moment, the way to fix this is to configure Trac to connect direct to Mailgun with the credentials previously supplied to Exim; just be sure to set use_tls, because of course it's disabled by default https://trac.edgewall.org/wiki/TracNotification#ConfigurationOptions <https://trac.edgewall.org/wiki/TracNotification#ConfigurationOptions> 🙄 -g
On Oct 4, 2021, at 2:27 AM, Thomas Grainger <tagrain@gmail.com> wrote:
the ticket was in fact created successfully - it was just the post-ticket hooks that failed https://twistedmatrix.com/trac/ticket/10262 _______________________________________________ Twisted mailing list -- twisted@python.org To unsubscribe send an email to twisted-leave@python.org https://mail.python.org/mailman3/lists/twisted.python.org/ Message archived at https://mail.python.org/archives/list/twisted@python.org/message/SOUYKWJ273G... Code of Conduct: https://twisted.org/conduct
Hi Chris, Thanks for the report. On Mon, 4 Oct 2021 at 09:31, Chris Withers <chris@withers.org> wrote:
Since Trac appears to be not accepting new issues, posting here before I forget:
Reproducer:
{{{ from twisted.trial.unittest import TestCase
class StatefulCleanup:
called = False
def __call__(self): if self.called: raise AssertionError('Called more than once') self.called = True
class TestAddCleanup(TestCase):
def setUp(self): self.addCleanup(StatefulCleanup())
def testIt(self): pass }}}
If run with trial -u, the AssertionError will be issued.
Chris
The ticket was created here https://twistedmatrix.com/trac/ticket/10262 It's just that a post ticket-create task was failing. Regards -- Adi Roiban
participants (4)
-
Adi Roiban
-
Chris Withers
-
Glyph
-
Thomas Grainger