summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-09 09:40:32 +0200
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-06-09 09:40:32 +0200
commitab5fcc807f48eefa032c8a07ff79e9e5bd6b93a6 (patch)
tree0bd5285c6e67505e32ee1cf05a029114710b5958 /tests/unittests/test_handler
parente6cfca0c898f0482f37216cf58e61ff1581aaaf6 (diff)
downloadvyos-cloud-init-ab5fcc807f48eefa032c8a07ff79e9e5bd6b93a6.tar.gz
vyos-cloud-init-ab5fcc807f48eefa032c8a07ff79e9e5bd6b93a6.zip
move SkipTest definition to tests/unittests/helpers.py to be reusable
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r--tests/unittests/test_handler/test_handler_apt_configure_sources_list.py21
1 files changed, 2 insertions, 19 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
index c3043b14..2e604216 100644
--- a/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
+++ b/tests/unittests/test_handler/test_handler_apt_configure_sources_list.py
@@ -7,23 +7,6 @@ import shutil
import tempfile
import socket
-# on SkipTest:
-# - unittest SkipTest is first preference, but it's only available
-# for >= 2.7
-# - unittest2 SkipTest is second preference for older pythons. This
-# mirrors logic for choosing SkipTest exception in testtools
-# - if none of the above, provide custom class
-try:
- from unittest.case import SkipTest
-except ImportError:
- try:
- from unittest2.case import SkipTest
- except ImportError:
- class SkipTest(Exception):
- """Raise this exception to mark a test as skipped.
- """
- pass
-
try:
from unittest import mock
except ImportError:
@@ -153,8 +136,8 @@ class TestAptSourceConfigSourceList(t_help.FilesystemMockingTestCase):
testsock.connect((target, 80))
testsock.close()
except socket.error:
- raise SkipTest("Test skipped: no network connectivity to %s"
- % target)
+ raise t_help.SkipTest("Test skipped: no network connectivity to %s"
+ % target)
def test_apt_srcl_debian_mirrorfail(self):
"""Test rendering of a source.list from template for debian"""