From 3cb605bf3cad72e692c154d41fb1e24b41033f2c Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:07:12 +0100 Subject: Use nosetests and absolute imports --- tests/unittests/test_builtin_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unittests/test_builtin_handlers.py b/tests/unittests/test_builtin_handlers.py index b387f13b..af7f442e 100644 --- a/tests/unittests/test_builtin_handlers.py +++ b/tests/unittests/test_builtin_handlers.py @@ -2,7 +2,7 @@ import os -from tests.unittests import helpers as test_helpers +from . import helpers as test_helpers from cloudinit import handlers from cloudinit import helpers -- cgit v1.2.3 From f9f97a734001b986b4f3be00a662de9218be71a7 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:13:03 +0100 Subject: more import statements --- tests/unittests/test_data.py | 2 +- tests/unittests/test_ec2_util.py | 2 +- tests/unittests/test_merging.py | 2 +- tests/unittests/test_pathprefix2dict.py | 2 +- tests/unittests/test_templating.py | 2 +- tests/unittests/test_util.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_data.py b/tests/unittests/test_data.py index 68729c57..41d0dc29 100644 --- a/tests/unittests/test_data.py +++ b/tests/unittests/test_data.py @@ -20,7 +20,7 @@ from cloudinit import util INSTANCE_ID = "i-testing" -from tests.unittests import helpers +from . import helpers class FakeDataSource(sources.DataSource): diff --git a/tests/unittests/test_ec2_util.py b/tests/unittests/test_ec2_util.py index dd87665d..26cd12ec 100644 --- a/tests/unittests/test_ec2_util.py +++ b/tests/unittests/test_ec2_util.py @@ -1,4 +1,4 @@ -from tests.unittests import helpers +from . import helpers from cloudinit import ec2_utils as eu from cloudinit import url_helper as uh diff --git a/tests/unittests/test_merging.py b/tests/unittests/test_merging.py index 486b9158..17704f8e 100644 --- a/tests/unittests/test_merging.py +++ b/tests/unittests/test_merging.py @@ -1,4 +1,4 @@ -from tests.unittests import helpers +from . import helpers from cloudinit.handlers import cloud_config from cloudinit.handlers import (CONTENT_START, CONTENT_END) diff --git a/tests/unittests/test_pathprefix2dict.py b/tests/unittests/test_pathprefix2dict.py index c68c263c..cedb391a 100644 --- a/tests/unittests/test_pathprefix2dict.py +++ b/tests/unittests/test_pathprefix2dict.py @@ -1,7 +1,7 @@ from cloudinit import util from mocker import MockerTestCase -from tests.unittests.helpers import populate_dir +from ..helpers import populate_dir class TestPathPrefix2Dict(MockerTestCase): diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py index 1ec3004b..87681f0f 100644 --- a/tests/unittests/test_templating.py +++ b/tests/unittests/test_templating.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from tests.unittests import helpers as test_helpers +from . import helpers as test_helpers import textwrap from cloudinit import templater diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 38ab0c96..335ab730 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -5,7 +5,7 @@ import stat import yaml from mocker import MockerTestCase -from tests.unittests import helpers +from . import helpers from unittest import TestCase from cloudinit import importer -- cgit v1.2.3 From 0259fb81b4234d7ecb0bf5e232c7cf534c582299 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:16:07 +0100 Subject: more --- tests/unittests/test_handler/test_handler_locale.py | 2 +- tests/unittests/test_handler/test_handler_power_state.py | 2 +- tests/unittests/test_handler/test_handler_seed_random.py | 2 +- tests/unittests/test_handler/test_handler_set_hostname.py | 2 +- tests/unittests/test_handler/test_handler_timezone.py | 2 +- tests/unittests/test_handler/test_handler_yum_add_repo.py | 2 +- tests/unittests/test_pathprefix2dict.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_handler/test_handler_locale.py b/tests/unittests/test_handler/test_handler_locale.py index 72ad00fd..eb251636 100644 --- a/tests/unittests/test_handler/test_handler_locale.py +++ b/tests/unittests/test_handler/test_handler_locale.py @@ -25,7 +25,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNoCloud -from tests.unittests import helpers as t_help +from .. import helpers as t_help from configobj import ConfigObj diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py index f6e37fa5..4b7b2112 100644 --- a/tests/unittests/test_handler/test_handler_power_state.py +++ b/tests/unittests/test_handler/test_handler_power_state.py @@ -1,6 +1,6 @@ from cloudinit.config import cc_power_state_change as psc -from tests.unittests import helpers as t_help +from .. import helpers as t_help class TestLoadPowerState(t_help.TestCase): diff --git a/tests/unittests/test_handler/test_handler_seed_random.py b/tests/unittests/test_handler/test_handler_seed_random.py index be2fa4a4..7bddb238 100644 --- a/tests/unittests/test_handler/test_handler_seed_random.py +++ b/tests/unittests/test_handler/test_handler_seed_random.py @@ -31,7 +31,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNone -from tests.unittests import helpers as t_help +from .. import helpers as t_help import logging diff --git a/tests/unittests/test_handler/test_handler_set_hostname.py b/tests/unittests/test_handler/test_handler_set_hostname.py index 6344ec0c..03004ab9 100644 --- a/tests/unittests/test_handler/test_handler_set_hostname.py +++ b/tests/unittests/test_handler/test_handler_set_hostname.py @@ -5,7 +5,7 @@ from cloudinit import distros from cloudinit import helpers from cloudinit import util -from tests.unittests import helpers as t_help +from .. import helpers as t_help import logging diff --git a/tests/unittests/test_handler/test_handler_timezone.py b/tests/unittests/test_handler/test_handler_timezone.py index 40b69773..874db340 100644 --- a/tests/unittests/test_handler/test_handler_timezone.py +++ b/tests/unittests/test_handler/test_handler_timezone.py @@ -25,7 +25,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNoCloud -from tests.unittests import helpers as t_help +from .. import helpers as t_help from configobj import ConfigObj diff --git a/tests/unittests/test_handler/test_handler_yum_add_repo.py b/tests/unittests/test_handler/test_handler_yum_add_repo.py index 7c6f7c40..156441c7 100644 --- a/tests/unittests/test_handler/test_handler_yum_add_repo.py +++ b/tests/unittests/test_handler/test_handler_yum_add_repo.py @@ -2,7 +2,7 @@ from cloudinit import util from cloudinit.config import cc_yum_add_repo -from tests.unittests import helpers +from .. import helpers import logging diff --git a/tests/unittests/test_pathprefix2dict.py b/tests/unittests/test_pathprefix2dict.py index cedb391a..590c4b82 100644 --- a/tests/unittests/test_pathprefix2dict.py +++ b/tests/unittests/test_pathprefix2dict.py @@ -1,7 +1,7 @@ from cloudinit import util from mocker import MockerTestCase -from ..helpers import populate_dir +from .helpers import populate_dir class TestPathPrefix2Dict(MockerTestCase): -- cgit v1.2.3 From dbe33d55259d488332783556877bc9f75e02285d Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:18:16 +0100 Subject: more --- tests/unittests/test_datasource/test_azure.py | 2 +- tests/unittests/test_datasource/test_cloudsigma.py | 2 +- tests/unittests/test_datasource/test_configdrive.py | 2 +- tests/unittests/test_datasource/test_gce.py | 2 +- tests/unittests/test_datasource/test_maas.py | 2 +- tests/unittests/test_datasource/test_nocloud.py | 2 +- tests/unittests/test_datasource/test_opennebula.py | 2 +- tests/unittests/test_datasource/test_openstack.py | 2 +- tests/unittests/test_datasource/test_smartos.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index ccfd672a..c7c977bd 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.util import load_file from cloudinit.sources import DataSourceAzure -from tests.unittests.helpers import populate_dir +from ...helpers import populate_dir import base64 import crypt diff --git a/tests/unittests/test_datasource/test_cloudsigma.py b/tests/unittests/test_datasource/test_cloudsigma.py index eadb3cb7..306ac7d8 100644 --- a/tests/unittests/test_datasource/test_cloudsigma.py +++ b/tests/unittests/test_datasource/test_cloudsigma.py @@ -4,7 +4,7 @@ import copy from cloudinit.cs_utils import Cepko from cloudinit.sources import DataSourceCloudSigma -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers SERVER_CONTEXT = { diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py index 4404668e..d88066e5 100644 --- a/tests/unittests/test_datasource/test_configdrive.py +++ b/tests/unittests/test_datasource/test_configdrive.py @@ -12,7 +12,7 @@ from cloudinit.sources import DataSourceConfigDrive as ds from cloudinit.sources.helpers import openstack from cloudinit import util -from tests.unittests import helpers as unit_helpers +from .. import helpers as unit_helpers PUBKEY = u'ssh-rsa AAAAB3NzaC1....sIkJhq8wdX+4I3A4cYbYP ubuntu@server-460\n' EC2_META = { diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py index 1979a0de..405dfbdb 100644 --- a/tests/unittests/test_datasource/test_gce.py +++ b/tests/unittests/test_datasource/test_gce.py @@ -24,7 +24,7 @@ from cloudinit import settings from cloudinit import helpers from cloudinit.sources import DataSourceGCE -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers GCE_META = { 'instance/id': '123', diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index 73cfadcb..0b616c64 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -3,7 +3,7 @@ import os from cloudinit.sources import DataSourceMAAS from cloudinit import url_helper -from tests.unittests.helpers import populate_dir +from ...helpers import populate_dir import mocker diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py index a65833eb..c106e639 100644 --- a/tests/unittests/test_datasource/test_nocloud.py +++ b/tests/unittests/test_datasource/test_nocloud.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceNoCloud from cloudinit import util -from tests.unittests.helpers import populate_dir +from ...helpers import populate_dir from mocker import MockerTestCase import os diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index ec6b752b..287aceba 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -2,7 +2,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceOpenNebula as ds from cloudinit import util from mocker import MockerTestCase -from tests.unittests.helpers import populate_dir +from ...helpers import populate_dir from base64 import b64encode import os diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py index 3a64430a..c5298aaa 100644 --- a/tests/unittests/test_datasource/test_openstack.py +++ b/tests/unittests/test_datasource/test_openstack.py @@ -24,7 +24,7 @@ from StringIO import StringIO from urlparse import urlparse -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers from cloudinit import helpers from cloudinit import settings diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py index f64aea07..b197b600 100644 --- a/tests/unittests/test_datasource/test_smartos.py +++ b/tests/unittests/test_datasource/test_smartos.py @@ -25,7 +25,7 @@ import base64 from cloudinit import helpers as c_helpers from cloudinit.sources import DataSourceSmartOS -from tests.unittests import helpers +from .. import helpers import os import os.path import re -- cgit v1.2.3 From 330d35b85bbf0ae90427e4949a18b132378eadbc Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:25:35 +0100 Subject: more --- tests/unittests/test_distros/test_generic.py | 2 +- tests/unittests/test_filters/test_launch_index.py | 2 +- tests/unittests/test_runs/test_merge_run.py | 2 +- tests/unittests/test_runs/test_simple_run.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/unittests/test_distros/test_generic.py b/tests/unittests/test_distros/test_generic.py index 7befb8c8..c24c790e 100644 --- a/tests/unittests/test_distros/test_generic.py +++ b/tests/unittests/test_distros/test_generic.py @@ -1,7 +1,7 @@ from cloudinit import distros from cloudinit import util -from tests.unittests import helpers +from .. import helpers import os diff --git a/tests/unittests/test_filters/test_launch_index.py b/tests/unittests/test_filters/test_launch_index.py index 773bb312..2f4c2fda 100644 --- a/tests/unittests/test_filters/test_launch_index.py +++ b/tests/unittests/test_filters/test_launch_index.py @@ -1,6 +1,6 @@ import copy -from tests.unittests import helpers +from .. import helpers import itertools diff --git a/tests/unittests/test_runs/test_merge_run.py b/tests/unittests/test_runs/test_merge_run.py index 5ffe95a2..32b41925 100644 --- a/tests/unittests/test_runs/test_merge_run.py +++ b/tests/unittests/test_runs/test_merge_run.py @@ -1,6 +1,6 @@ import os -from tests.unittests import helpers +from .. import helpers from cloudinit.settings import (PER_INSTANCE) from cloudinit import stages diff --git a/tests/unittests/test_runs/test_simple_run.py b/tests/unittests/test_runs/test_simple_run.py index 9a7178d1..c9ba949e 100644 --- a/tests/unittests/test_runs/test_simple_run.py +++ b/tests/unittests/test_runs/test_simple_run.py @@ -1,6 +1,6 @@ import os -from tests.unittests import helpers +from .. import helpers from cloudinit.settings import (PER_INSTANCE) from cloudinit import stages -- cgit v1.2.3 From 272b8aae291b4b177fb6340aba9907e89bd0905c Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:50:45 +0100 Subject: more --- packages/debian/rules | 4 +--- tests/unittests/test_datasource/test_azure.py | 2 +- tests/unittests/test_datasource/test_maas.py | 2 +- tests/unittests/test_datasource/test_nocloud.py | 2 +- tests/unittests/test_datasource/test_opennebula.py | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/packages/debian/rules b/packages/debian/rules index 6c3bf526..3bec7267 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,6 +1,7 @@ #!/usr/bin/make -f INIT_SYSTEM ?= upstart,systemd +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) %: dh $@ --with python2,systemd --buildsystem pybuild @@ -12,6 +13,3 @@ override_dh_install: override_dh_auto_test: http_proxy= dh_auto_test -- --test-nose - -override_dh_auto_install: - dh_auto_install -- --init-system=$(INIT_SYSTEM) diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index c7c977bd..88c82d5e 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.util import load_file from cloudinit.sources import DataSourceAzure -from ...helpers import populate_dir +from ..helpers import populate_dir import base64 import crypt diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index 0b616c64..c157beb8 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -3,7 +3,7 @@ import os from cloudinit.sources import DataSourceMAAS from cloudinit import url_helper -from ...helpers import populate_dir +from ..helpers import populate_dir import mocker diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py index c106e639..14274562 100644 --- a/tests/unittests/test_datasource/test_nocloud.py +++ b/tests/unittests/test_datasource/test_nocloud.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceNoCloud from cloudinit import util -from ...helpers import populate_dir +from ..helpers import populate_dir from mocker import MockerTestCase import os diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index 287aceba..b4fd1f4d 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -2,7 +2,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceOpenNebula as ds from cloudinit import util from mocker import MockerTestCase -from ...helpers import populate_dir +from ..helpers import populate_dir from base64 import b64encode import os -- cgit v1.2.3 From d6b77380f9e0a3d083300c6168c71466068094cf Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 24 Jul 2014 09:06:16 -0400 Subject: pep8 fixes (2 unrelated to this mp) --- cloudinit/netinfo.py | 4 ++-- setup.py | 2 ++ tests/unittests/test_handler/test_handler_growpart.py | 4 ++-- tests/unittests/test_handler/test_handler_seed_random.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/cloudinit/netinfo.py b/cloudinit/netinfo.py index 30b6f3b3..1bdca9f7 100644 --- a/cloudinit/netinfo.py +++ b/cloudinit/netinfo.py @@ -56,8 +56,8 @@ def netdev_info(empty=""): # newer (freebsd and fedora) show 'inet xx.yy' # just skip this 'inet' entry. (LP: #1285185) try: - if (toks[i] in ("inet", "inet6") and - toks[i + 1].startswith("addr:")): + if ((toks[i] in ("inet", "inet6") and + toks[i + 1].startswith("addr:"))): continue except IndexError: pass diff --git a/setup.py b/setup.py index 502b057b..556103b9 100755 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ import subprocess def is_f(p): return os.path.isfile(p) + def tiny_p(cmd, capture=True): # Darn python 2.6 doesn't have check_output (argggg) stdout = subprocess.PIPE @@ -51,6 +52,7 @@ def tiny_p(cmd, capture=True): % (cmd, ret, out, err)) return (out, err) + def systemd_unitdir(): cmd = ['pkg-config', '--variable=systemdsystemunitdir', 'systemd'] try: diff --git a/tests/unittests/test_handler/test_handler_growpart.py b/tests/unittests/test_handler/test_handler_growpart.py index f2ed4597..f6dc4521 100644 --- a/tests/unittests/test_handler/test_handler_growpart.py +++ b/tests/unittests/test_handler/test_handler_growpart.py @@ -188,8 +188,8 @@ class TestResize(MockerTestCase): self.assertEqual(cc_growpart.RESIZE.SKIPPED, find(enoent[0], resized)[1]) #self.assertEqual(resize_calls, - #[("/dev/XXda", "1", "/dev/XXda1"), - #("/dev/YYda", "2", "/dev/YYda2")]) + # [("/dev/XXda", "1", "/dev/XXda1"), + # ("/dev/YYda", "2", "/dev/YYda2")]) finally: cc_growpart.device_part_info = opinfo os.stat = real_stat diff --git a/tests/unittests/test_handler/test_handler_seed_random.py b/tests/unittests/test_handler/test_handler_seed_random.py index 7bddb238..40481f16 100644 --- a/tests/unittests/test_handler/test_handler_seed_random.py +++ b/tests/unittests/test_handler/test_handler_seed_random.py @@ -1,4 +1,4 @@ - # Copyright (C) 2013 Hewlett-Packard Development Company, L.P. +# Copyright (C) 2013 Hewlett-Packard Development Company, L.P. # # Author: Juerg Haefliger # -- cgit v1.2.3