Interrupting distributed testing does not call teardown fns

Issue #79 resolved
memedough created an issue

Hi Holger,

Fixtures don't appear to call teardown fns if the testing is interrupted with SIGINT (hitting control C).

I tested xunit style for setup/teardown at module, class and method level.

I tested funcarg style for setup/teardown at session, module and function level.

All were consistent.

Without interrupting all the setup and teardown fns were called correctly, which is good.

However, interrupting the test will result in the teardown fns not being called.

I didn't test non distributed testing - so I make a (potentially incorrect) assumption that it behaves the same way.

I suggest that once a setup fn has been called the corresponding teardown should be called at all costs. Exceptions, hitting control c, whatever should be handled so that each teardown fn is called in turn even if a teardown raises a new exception (a teardown failure to release a resource should not cause another resource to be leaked).

:)

Comments (4)

  1. memedough reporter
    • marked as bug
    • changed version to 1.2

    Note, I did test this with the latest today - py-1.2.0, pytest_xdist-1.1, execnet-1.0.4.

    :)

  2. Holger Krekel repo owner
    • changed component to xdist

    this is only an issue with the xdist plugin. with "normal" testing ctrl-c implies calling the teardown iisic.

  3. Holger Krekel repo owner

    sending SIGINT to slaves should now properly invoke hooks. You need a recent py-trunk and xdist checkout for it. if you can confirm that'd be welcome.

  4. memedough reporter

    Hi,

    I test with dev versions today.

    I can confirm that this works now which is great. I no longer manual clean up!

    :)

  5. Log in to comment