summaryrefslogtreecommitdiff
path: root/tests/unittests/test_distros/test_resolv.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-11-13 08:48:19 -0500
committerScott Moser <smoser@ubuntu.com>2012-11-13 08:48:19 -0500
commitcd8fbfffdf7ba9ba79d39ee7b4a223d1bd7863b4 (patch)
tree57d45de94ed5aeb8a6e03b6fb6366af43ffdd3c6 /tests/unittests/test_distros/test_resolv.py
parent8e86b79e8a5ab299ca77ec5e69facb807ede322f (diff)
downloadvyos-cloud-init-cd8fbfffdf7ba9ba79d39ee7b4a223d1bd7863b4.tar.gz
vyos-cloud-init-cd8fbfffdf7ba9ba79d39ee7b4a223d1bd7863b4.zip
replace 'with self.assertRaises(Exception):' with different form
I'm guessing that with self.assertRaises(Exception): something here is an acceptable form in a newer or older python. But my python (2.7.3-0ubuntu7) doesn't like it. Interestingly, python unittest doc says: | Changed in version 2.7: Added the ability to use assertRaises() as | a context manager.
Diffstat (limited to 'tests/unittests/test_distros/test_resolv.py')
-rw-r--r--tests/unittests/test_distros/test_resolv.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py
index d947dda0..6b6ff6aa 100644
--- a/tests/unittests/test_distros/test_resolv.py
+++ b/tests/unittests/test_distros/test_resolv.py
@@ -38,8 +38,7 @@ class TestResolvHelper(MockerTestCase):
self.assertNotIn('10.3', rp.nameservers)
self.assertEquals(len(rp.nameservers), 3)
rp.add_nameserver('10.2')
- with self.assertRaises(ValueError):
- rp.add_nameserver('10.3')
+ self.assertRaises(ValueError, rp.add_nameserver, '10.3')
self.assertNotIn('10.3', rp.nameservers)
def test_search_domains(self):
@@ -58,6 +57,5 @@ class TestResolvHelper(MockerTestCase):
self.assertEquals(len(rp.search_domains), 5)
rp.add_search_domain('bbb4.y.com')
self.assertEquals(len(rp.search_domains), 6)
- with self.assertRaises(ValueError):
- rp.add_search_domain('bbb5.y.com')
+ self.assertRaises(ValueError, rp.add_search_domain, 'bbb5.y.com')
self.assertEquals(len(rp.search_domains), 6)