aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-01-28 11:30:47 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-01-28 11:54:16 +0100
commit52da4424869eecd428c29a41f1699e6e00767055 (patch)
tree081a4ea6045ea8b8960c64f611bcc69bb6f17bf8 /functest/opnfv_tests/openstack/snaps
parentc6092cb676363d89f366dc9a416ba6c53eeea33f (diff)
Fix warnings in all snaps-related modules
It also adds vping/__init__.py to stop skipping vping unit tests. It removes the useless import os which is not required for mock (here the mock patch was simply false). It should be noted that the code is partially duplicated between snaps_test_runner.py and vping_base_base.py. A small part of code has been rewritten to fix that without multi inheritance. Change-Id: I2e3e181ad7dab8aa41afb1e63d0b6795ff0d1610 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps')
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py4
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py7
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py6
7 files changed, 35 insertions, 6 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index e708b4dec..e8b9c3227 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
@@ -6,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import unittest
from functest.opnfv_tests.openstack.snaps import snaps_suite_builder
@@ -38,4 +42,4 @@ class ApiCheck(SnapsTestRunner):
ext_net_name=self.ext_net_name,
use_keystone=self.use_keystone,
image_metadata=self.image_metadata)
- return super(self.__class__, self).run()
+ return super(ApiCheck, self).run()
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 1fc49349e..f8bf8852e 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
@@ -6,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import unittest
from functest.opnfv_tests.openstack.snaps import snaps_suite_builder
@@ -37,4 +41,4 @@ class ConnectionCheck(SnapsTestRunner):
os_creds=self.os_creds,
ext_net_name=self.ext_net_name,
use_keystone=self.use_keystone)
- return super(self.__class__, self).run()
+ return super(ConnectionCheck, self).run()
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 837c2eae7..db882c382 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
@@ -6,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import unittest
from functest.opnfv_tests.openstack.snaps.snaps_test_runner import (
@@ -42,4 +46,4 @@ class HealthCheck(SnapsTestRunner):
flavor_metadata=self.flavor_metadata,
image_metadata=self.image_metadata,
netconf_override=self.netconf_override))
- return super(self.__class__, self).run()
+ return super(HealthCheck, self).run()
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index ded149d0c..ef6e5dc9f 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
@@ -6,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import unittest
from functest.opnfv_tests.openstack.snaps import snaps_suite_builder
@@ -41,4 +45,4 @@ class SnapsSmoke(SnapsTestRunner):
image_metadata=self.image_metadata,
use_floating_ips=self.use_fip,
netconf_override=self.netconf_override)
- return super(self.__class__, self).run()
+ return super(SnapsSmoke, self).run()
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py b/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py
index 3e7c0a39f..c3d8c2d8b 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py
@@ -8,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import logging
from snaps.openstack.tests.create_flavor_tests import (
@@ -119,6 +121,7 @@ def add_openstack_client_tests(suite, os_creds, ext_net_name,
def add_openstack_api_tests(suite, os_creds, ext_net_name, use_keystone=True,
image_metadata=None, log_level=logging.INFO):
+ # pylint: disable=too-many-arguments
"""
Adds tests written to exercise all existing OpenStack APIs
:param suite: the unittest.TestSuite object to which to add the tests
@@ -232,6 +235,7 @@ def add_openstack_integration_tests(suite, os_creds, ext_net_name,
image_metadata=None, use_floating_ips=True,
netconf_override=None,
log_level=logging.INFO):
+ # pylint: disable=too-many-arguments
"""
Adds tests written to exercise all long-running OpenStack integration tests
meaning they will be creating VM instances and potentially performing some
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 6dc8288bf..94c8af85d 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
@@ -6,6 +8,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import logging
from functest.core import unit
@@ -17,13 +21,14 @@ from snaps.openstack.tests import openstack_tests
class SnapsTestRunner(unit.Suite):
+ # pylint: disable=too-many-instance-attributes
"""
This test executes the SNAPS Python Tests
"""
+
def __init__(self, **kwargs):
super(SnapsTestRunner, self).__init__(**kwargs)
self.logger = logging.getLogger(__name__)
-
if 'os_creds' in kwargs:
self.os_creds = kwargs['os_creds']
else:
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 284e88b51..1153b63df 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -5,6 +7,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
from functest.utils.constants import CONST
from snaps.openstack.utils import neutron_utils, nova_utils
@@ -19,7 +23,7 @@ def get_ext_net_name(os_creds):
"""
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
- if (hasattr(CONST, 'EXTERNAL_NETWORK')):
+ if hasattr(CONST, 'EXTERNAL_NETWORK'):
extnet_config = CONST.__getattribute__('EXTERNAL_NETWORK')
for ext_net in ext_nets:
if ext_net.name == extnet_config: