← Back to team overview

testtools-dev team mailing list archive

[Merge] lp:~gz/testtools/skip_sigint_tests_on_non_posix into lp:testtools

 

Martin [gz] has proposed merging lp:~gz/testtools/skip_sigint_tests_on_non_posix into lp:testtools.

Requested reviews:
  testtools developers (testtools-dev)


There's no os.kill on windows, even though something named that was added in Python 2.7 you can't generally use it as you would with posix signals. It may be possible to write what at least some of these tests are trying to do with another mechanism like thread.interrupt_main but in the absence of understanding I've just made these tests skip on non-posix systems.
-- 
https://code.launchpad.net/~gz/testtools/skip_sigint_tests_on_non_posix/+merge/39283
Your team testtools developers is requested to review the proposed merge of lp:~gz/testtools/skip_sigint_tests_on_non_posix into lp:testtools.
=== modified file 'testtools/tests/test_deferredruntest.py'
--- testtools/tests/test_deferredruntest.py	2010-10-24 08:41:51 +0000
+++ testtools/tests/test_deferredruntest.py	2010-10-25 15:28:20 +0000
@@ -6,6 +6,7 @@
 import signal
 
 from testtools import (
+    skipIf,
     TestCase,
     )
 from testtools.deferredruntest import (
@@ -350,6 +351,7 @@
                 'unhandled-error-in-deferred-1',
                 ]))
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_keyboard_interrupt_stops_test_run(self):
         # If we get a SIGINT during a test run, the test stops and no more
         # tests run.
@@ -367,6 +369,7 @@
         reactor.callLater(timeout, os.kill, os.getpid(), SIGINT)
         self.assertRaises(KeyboardInterrupt, runner.run, result)
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_fast_keyboard_interrupt_stops_test_run(self):
         # If we get a SIGINT during a test run, the test stops and no more
         # tests run.

=== modified file 'testtools/tests/test_spinner.py'
--- testtools/tests/test_spinner.py	2010-10-24 08:41:51 +0000
+++ testtools/tests/test_spinner.py	2010-10-25 15:28:20 +0000
@@ -6,6 +6,7 @@
 import signal
 
 from testtools import (
+    skipIf,
     TestCase,
     )
 from testtools.matchers import (
@@ -273,6 +274,7 @@
         self.assertThat(junk, Equals([port]))
         self.assertThat(spinner.get_junk(), Equals([]))
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_sigint_raises_no_result_error(self):
         # If we get a SIGINT during a run, we raise NoResultError.
         SIGINT = getattr(signal, 'SIGINT', None)
@@ -286,12 +288,14 @@
             NoResultError, spinner.run, timeout * 5, defer.Deferred)
         self.assertEqual([], spinner._clean())
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_sigint_raises_no_result_error_second_time(self):
         # If we get a SIGINT during a run, we raise NoResultError.  This test
         # is exactly the same as test_sigint_raises_no_result_error, and
         # exists to make sure we haven't futzed with state.
         self.test_sigint_raises_no_result_error()
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_fast_sigint_raises_no_result_error(self):
         # If we get a SIGINT during a run, we raise NoResultError.
         SIGINT = getattr(signal, 'SIGINT', None)
@@ -305,6 +309,7 @@
             NoResultError, spinner.run, timeout * 5, defer.Deferred)
         self.assertEqual([], spinner._clean())
 
+    @skipIf(os.name != "posix", "Sending SIGINT with os.kill is posix only")
     def test_fast_sigint_raises_no_result_error_second_time(self):
         self.test_fast_sigint_raises_no_result_error()
 


Follow ups