diff options
author | Robert Collins <robertc@robertcollins.net> | 2015-03-27 11:27:22 +1300 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2015-03-27 11:27:22 +1300 |
commit | 31b58068803641dea8b13e186bb45c47b53a6601 (patch) | |
tree | 66e1fe5b6d8923c12eccf1799a6df0f5e37eb3a6 /fixtures/tests | |
parent | 90ce7d729f611311035ed1538d3fe3810af70c35 (diff) | |
download | fixtures-git-31b58068803641dea8b13e186bb45c47b53a6601.tar.gz |
Fixed test performance on Python 3.5.
PEP 475 led to ``time.sleep()`` not being interrupted when a received signal
handler eats the signal (rather than raising an exception). (Robert Collins)
Diffstat (limited to 'fixtures/tests')
-rw-r--r-- | fixtures/tests/_fixtures/test_timeout.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fixtures/tests/_fixtures/test_timeout.py b/fixtures/tests/_fixtures/test_timeout.py index 266e257..3239746 100644 --- a/fixtures/tests/_fixtures/test_timeout.py +++ b/fixtures/tests/_fixtures/test_timeout.py @@ -20,6 +20,7 @@ import testtools from testtools.testcase import ( TestSkipped, ) +from testtools.matchers import raises import fixtures @@ -57,10 +58,9 @@ class TestTimeout(testtools.TestCase, fixtures.TestWithFixtures): self.requireUnix() # This will normally kill the whole process, which would be # inconvenient. Let's hook the alarm here so we can observe it. - self.got_alarm = False + class GotAlarm(Exception):pass def sigalrm_handler(signum, frame): - self.got_alarm = True + raise GotAlarm() old_handler = signal.signal(signal.SIGALRM, sigalrm_handler) self.addCleanup(signal.signal, signal.SIGALRM, old_handler) - sample_long_delay_with_harsh_timeout() - self.assertTrue(self.got_alarm) + self.assertThat(sample_long_delay_with_harsh_timeout, raises(GotAlarm)) |