#3600 closed defect (fixed)

allmydata.test.common.*TestCase have broken skip/cleanup interaction

Reported by: exarkun Owned by: GitHub <noreply@…>
Priority: normal Milestone: undecided
Component: unknown Version: n/a
Keywords: Cc:
Launchpad Bug:

Description

Cleanups added using testtools.TestCase.addCleanup are never run if the test they're associated with is skipped using unittest.skip (or one of its cousins).

This is usually fine because if the test is going to be skipped like this then you usually can't call addCleanup.

But allmydata.test.eliotutil.EliotLoggedRunTest uses eliot_logged_test to call addCleanup *before* testtools.TestCase.run is called.

This means addCleanup is called and then run applies its skip logic to not run any of the cleanups.

Change History (2)

comment:1 Changed at 2021-01-26T21:22:46Z by exarkun

It seems like the solution may be to stop using cleanups for this cleanup.

Instead, rely on the fact that testtools.runtest.RunTest.run is actually a synchronous interface (even in the case of AsyncTestCase?). This means we can just use try/finally to manage cleanups.

As a bonus, this probably makes a lot of the code simpler.

comment:2 Changed at 2021-02-12T17:10:42Z by GitHub <noreply@…>

  • Owner set to GitHub <noreply@…>
  • Resolution set to fixed
  • Status changed from new to closed

In 0b45c259/trunk:

Merge pull request #973 from LeastAuthority?/3600.eliotutil-vs-skips

Fix the per-test Eliot decoration to interact better with testtools skips

Fixes: ticket:3600

Note: See TracTickets for help on using tickets.