Cleanups added with addCleanup incorrectly called on subsequent runs when using `trial -u`
![](https://secure.gravatar.com/avatar/599519579a707ab348b35cf68477df08.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/05917fed26d7519fae8318f78d14592a.jpg?s=120&d=mm&r=g)
the ticket was in fact created successfully - it was just the post-ticket hooks that failed https://twistedmatrix.com/trac/ticket/10262
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/eba6eb871de2549c7447a8701352cd35.jpg?s=120&d=mm&r=g)
Hi Chris, Thanks for the report. On Mon, 4 Oct 2021 at 09:31, Chris Withers <chris@withers.org> wrote:
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
![](https://secure.gravatar.com/avatar/05917fed26d7519fae8318f78d14592a.jpg?s=120&d=mm&r=g)
the ticket was in fact created successfully - it was just the post-ticket hooks that failed https://twistedmatrix.com/trac/ticket/10262
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/eba6eb871de2549c7447a8701352cd35.jpg?s=120&d=mm&r=g)
Hi Chris, Thanks for the report. On Mon, 4 Oct 2021 at 09:31, Chris Withers <chris@withers.org> wrote:
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