[py-dev] KeyboardInterrupt during setup() and teardown()

Pärham Fazelzadeh H parhamfh at kth.se
Thu Jul 12 11:46:36 CEST 2012


Hi all,

I am using py.test to perform integration and functional testing of an
application and had some issues with interrupts and was advised to submit
my use case.

Basically the problem is related to funcargs and how setup() and teardown()
are affected by interrupts. The issue we are having is that some of our
funcargs take longer to setup than what is maybe recommended. One of the
funcargs instantiate and start the application that is to be tested and
this can take some time; in the setup() you basically wait for the
application to boot up to verify that it has started. If a
KeyboardInterrupt is raised during setup() it will leave the application in
a dirty state since no teardown will be run, i.e the application will be
left running. Similarly this can happen during configuration stages in
funcargs.

I learned that this is default behaviour (and also reasonable), seeing as
the idea is that funcargs should be small and be fast.

Still, this is our use case so here you go! :)

Regards,
Parham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20120712/01ac61fa/attachment.html>


More information about the Pytest-dev mailing list