diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-05-15 16:57:35 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-05-15 16:57:35 -0400 |
commit | 2dc69f02e30cf6c89a9f0f036e797c78d8e00b84 (patch) | |
tree | 400d3225f61f3fff539f4605ba5ce486cdd4f4f9 /tests/unittests/test_cli.py | |
parent | 33db529855c0c0746091868c69f5d694bff7b9a8 (diff) | |
download | vyos-cloud-init-2dc69f02e30cf6c89a9f0f036e797c78d8e00b84.tar.gz vyos-cloud-init-2dc69f02e30cf6c89a9f0f036e797c78d8e00b84.zip |
temporarily disasble test if no bin/cloud-init
the tests of bin/cloud-init would fail in a package build environment.
so, temporariliy skip them in that environment.
Diffstat (limited to 'tests/unittests/test_cli.py')
-rw-r--r-- | tests/unittests/test_cli.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py index ba447f87..ed863399 100644 --- a/tests/unittests/test_cli.py +++ b/tests/unittests/test_cli.py @@ -1,6 +1,6 @@ import imp +import os import sys - import six from . import helpers as test_helpers @@ -11,6 +11,9 @@ except ImportError: import mock +BIN_CLOUDINIT = "bin/cloud-init" + + class TestCLI(test_helpers.FilesystemMockingTestCase): def setUp(self): @@ -25,16 +28,18 @@ class TestCLI(test_helpers.FilesystemMockingTestCase): self.patched_funcs.enter_context( mock.patch.object(sys, 'argv', ['cloud-init'])) cli = imp.load_module( - 'cli', open('bin/cloud-init'), '', ('', 'r', imp.PY_SOURCE)) + 'cli', open(BIN_CLOUDINIT), '', ('', 'r', imp.PY_SOURCE)) try: return cli.main() except: pass + @test_helpers.skipIf(not os.path.isfile(BIN_CLOUDINIT), "no bin/cloudinit") def test_no_arguments_shows_usage(self): self._call_main() self.assertIn('usage: cloud-init', self.stderr.getvalue()) + @test_helpers.skipIf(not os.path.isfile(BIN_CLOUDINIT), "no bin/cloudinit") def test_no_arguments_exits_2(self): exit_code = self._call_main() if self.sys_exit.call_count: @@ -42,6 +47,7 @@ class TestCLI(test_helpers.FilesystemMockingTestCase): else: self.assertEqual(2, exit_code) + @test_helpers.skipIf(not os.path.isfile(BIN_CLOUDINIT), "no bin/cloudinit") def test_no_arguments_shows_error_message(self): self._call_main() self.assertIn('cloud-init: error: too few arguments', |