diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-09-26 16:40:07 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-09-26 16:40:07 -0700 |
commit | 4a5d5a044db9e77b931fb4df93f7c01b02021f44 (patch) | |
tree | 24b67e58e2c5c193dc2b98c1a88ed1cf8e2a4a70 /tests/unittests | |
parent | f31a4e80aaaafca79eb6c808c81a6067f0c493b8 (diff) | |
download | vyos-cloud-init-4a5d5a044db9e77b931fb4df93f7c01b02021f44.tar.gz vyos-cloud-init-4a5d5a044db9e77b931fb4df93f7c01b02021f44.zip |
Fixup some pylint warnings.
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/helpers.py | 8 | ||||
-rw-r--r-- | tests/unittests/test_filters/test_launch_index.py | 12 | ||||
-rw-r--r-- | tests/unittests/test_runs/test_simple_run.py | 14 |
3 files changed, 19 insertions, 15 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index d7aebdee..7b829f24 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -1,7 +1,5 @@ import os -import mocker - from mocker import MockerTestCase from cloudinit import helpers as ch @@ -84,7 +82,7 @@ class FilesystemMockingTestCase(ResourceUsingTestCase): def replicateTestRoot(self, example_root, target_root): real_root = self.resourceLocation() real_root = os.path.join(real_root, 'roots', example_root) - for (dir_path, dirnames, filenames) in os.walk(real_root): + for (dir_path, _dirnames, filenames) in os.walk(real_root): real_path = dir_path make_path = rebase_path(real_path[len(real_root):], target_root) util.ensure_dir(make_path) @@ -122,13 +120,13 @@ class FilesystemMockingTestCase(ResourceUsingTestCase): # Handle subprocess calls func = getattr(util, 'subp') - def nsubp(*args, **kwargs): + def nsubp(*_args, **_kwargs): return ('', '') setattr(util, 'subp', nsubp) self.patched_funcs.append((util, 'subp', func)) - def null_func(*args, **kwargs): + def null_func(*_args, **_kwargs): return None for f in ['chownbyid', 'chownbyname']: diff --git a/tests/unittests/test_filters/test_launch_index.py b/tests/unittests/test_filters/test_launch_index.py index 7ca7cbb6..1e9b9053 100644 --- a/tests/unittests/test_filters/test_launch_index.py +++ b/tests/unittests/test_filters/test_launch_index.py @@ -1,6 +1,14 @@ import copy +import os +import sys -import helpers as th +top_dir = os.path.join(os.path.dirname(__file__), os.pardir, "helpers.py") +top_dir = os.path.abspath(top_dir) +if os.path.exists(top_dir): + sys.path.insert(0, os.path.dirname(top_dir)) + + +import helpers import itertools @@ -18,7 +26,7 @@ def count_messages(root): return am -class TestLaunchFilter(th.ResourceUsingTestCase): +class TestLaunchFilter(helpers.ResourceUsingTestCase): def assertCounts(self, message, expected_counts): orig_message = copy.deepcopy(message) diff --git a/tests/unittests/test_runs/test_simple_run.py b/tests/unittests/test_runs/test_simple_run.py index 33dd3ca2..7f646b54 100644 --- a/tests/unittests/test_runs/test_simple_run.py +++ b/tests/unittests/test_runs/test_simple_run.py @@ -1,6 +1,3 @@ -from mocker import MockerTestCase - -import mocker import sys import os @@ -19,7 +16,7 @@ from cloudinit import stages from cloudinit.settings import (PER_INSTANCE) -class TestSimpleRunDistro(helpers.FilesystemMockingTestCase): +class TestSimpleRun(helpers.FilesystemMockingTestCase): def _patchIn(self, root): self.restore() self.patchOS(root) @@ -76,13 +73,14 @@ class TestSimpleRunDistro(helpers.FilesystemMockingTestCase): initer.update() self.assertTrue(os.path.islink("var/lib/cloud/instance")) - (ran, results) = initer.cloudify().run('consume_userdata', - initer.consume_userdata, - args=[PER_INSTANCE], - freq=PER_INSTANCE) + initer.cloudify().run('consume_userdata', + initer.consume_userdata, + args=[PER_INSTANCE], + freq=PER_INSTANCE) mods = stages.Modules(initer) (which_ran, failures) = mods.run_section('cloud_init_modules') + self.assertTrue(len(failures) == 0) self.assertTrue(os.path.exists('/etc/blah.ini')) self.assertIn('write-files', which_ran) contents = util.load_file('/etc/blah.ini') |