diff options
author | Sean Dague <sean@dague.net> | 2014-12-09 09:04:42 -0500 |
---|---|---|
committer | Sean Dague <sean@dague.net> | 2014-12-10 08:51:30 -0500 |
commit | 666cccd3eb212ec82bb04101bfe710fb27a152c7 (patch) | |
tree | b237cf889684e917ab96368ccf2da429b167403f /nova/tests/unit/test_fixtures.py | |
parent | 27b03dbd9f67720c388e1fdea5177f068988b6c8 (diff) | |
download | nova-666cccd3eb212ec82bb04101bfe710fb27a152c7.tar.gz |
extract the timeout setup as a fixture
Includes tests for the nova specific parts of this.
Change-Id: I591f3c270804dfb01eab7c8c5d43b87a7abcdeda
Diffstat (limited to 'nova/tests/unit/test_fixtures.py')
-rw-r--r-- | nova/tests/unit/test_fixtures.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/tests/unit/test_fixtures.py b/nova/tests/unit/test_fixtures.py index e667486968..bf1671f84e 100644 --- a/nova/tests/unit/test_fixtures.py +++ b/nova/tests/unit/test_fixtures.py @@ -124,3 +124,24 @@ class TestLogging(testtools.TestCase): log.debug("at debug") self.assertIn("at info", stdlog.logger.output) self.assertIn("at debug", stdlog.logger.output) + + +class TestTimeout(testtools.TestCase): + """Tests for our timeout fixture. + + Testing the actual timeout mechanism is beyond the scope of this + test, because it's a pretty clear pass through to fixtures' + timeout fixture, which tested in their tree. + + """ + def test_scaling(self): + # a bad scaling factor + self.assertRaises(ValueError, fixtures.Timeout, 1, 0.5) + + # various things that should work. + timeout = fixtures.Timeout(10) + self.assertEqual(timeout.test_timeout, 10) + timeout = fixtures.Timeout("10") + self.assertEqual(timeout.test_timeout, 10) + timeout = fixtures.Timeout("10", 2) + self.assertEqual(timeout.test_timeout, 20) |