Merge "Fix relative imports in nfv"
This commit is contained in:
commit
8f7fda26c1
|
@ -1,4 +1,4 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
test_path=./nfv-tests/nfv_unit_tests/tests
|
test_path=./nfv-tests/nfv_unit_tests/tests
|
||||||
top_dir=.
|
top_dir=./nfv-tests
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2018 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -23,7 +23,7 @@ from nfv_common import debug
|
||||||
from nfv_common import forensic
|
from nfv_common import forensic
|
||||||
from nfv_plugins.nfvi_plugins import config
|
from nfv_plugins.nfvi_plugins import config
|
||||||
|
|
||||||
import tests # pylint: disable=relative-import
|
import tests
|
||||||
|
|
||||||
|
|
||||||
DLOG = debug.debug_get_logger('nfv_tests')
|
DLOG = debug.debug_get_logger('nfv_tests')
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
from setuptools import find_packages
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
@ -12,7 +11,9 @@ setup(
|
||||||
version='1.0.0',
|
version='1.0.0',
|
||||||
license='Apache-2.0',
|
license='Apache-2.0',
|
||||||
platforms=['any'],
|
platforms=['any'],
|
||||||
provides='nfv_scenario_tests',
|
provides=['nfv_scenario_tests'],
|
||||||
data_files=['./config.ini'],
|
data_files=['./config.ini'],
|
||||||
packages=find_packages()
|
packages=['nfv_scenario_tests.tests'],
|
||||||
|
package_dir={'nfv_scenario_tests.tests': 'tests'},
|
||||||
|
scripts=['main.py']
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
|
@ -1,9 +1,8 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 Wind River Systems, Inc.
|
# Copyright (c) 2015-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
from setuptools import find_packages
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
@ -12,6 +11,7 @@ setup(
|
||||||
version='1.0.0',
|
version='1.0.0',
|
||||||
license='Apache-2.0',
|
license='Apache-2.0',
|
||||||
platforms=['any'],
|
platforms=['any'],
|
||||||
provides='nfv_unit_tests',
|
provides=['nfv_unit_tests'],
|
||||||
packages=find_packages()
|
packages=['nfv_unit_tests.tests'],
|
||||||
|
package_dir={'nfv_unit_tests.tests': 'tests'}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2020 Wind River Systems, Inc.
|
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -13,6 +13,7 @@ from nfv_vim import host_fsm
|
||||||
from nfv_vim import nfvi
|
from nfv_vim import nfvi
|
||||||
from nfv_vim import objects
|
from nfv_vim import objects
|
||||||
|
|
||||||
|
from nfv_vim.objects import HOST_PERSONALITY
|
||||||
from nfv_vim.strategy._strategy import strategy_rebuild_from_dict
|
from nfv_vim.strategy._strategy import strategy_rebuild_from_dict
|
||||||
from nfv_vim.tables._host_aggregate_table import HostAggregateTable
|
from nfv_vim.tables._host_aggregate_table import HostAggregateTable
|
||||||
from nfv_vim.tables._host_group_table import HostGroupTable
|
from nfv_vim.tables._host_group_table import HostGroupTable
|
||||||
|
@ -21,10 +22,9 @@ from nfv_vim.tables._instance_group_table import InstanceGroupTable
|
||||||
from nfv_vim.tables._instance_table import InstanceTable
|
from nfv_vim.tables._instance_table import InstanceTable
|
||||||
from nfv_vim.tables._table import Table
|
from nfv_vim.tables._table import Table
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
from . import utils # noqa: H304
|
from nfv_unit_tests.tests import utils
|
||||||
|
|
||||||
from nfv_vim.objects import HOST_PERSONALITY
|
|
||||||
|
|
||||||
DEBUG_PRINTING = False
|
DEBUG_PRINTING = False
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
# Copyright (c) 2016-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -11,7 +11,7 @@ import tempfile
|
||||||
from nfv_vim import database
|
from nfv_vim import database
|
||||||
from nfv_vim import tables
|
from nfv_vim import tables
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
|
|
||||||
|
|
||||||
class TestNFVDatabaseUpgrade(testcase.NFVTestCase):
|
class TestNFVDatabaseUpgrade(testcase.NFVTestCase):
|
||||||
|
|
|
@ -16,11 +16,14 @@ from nfv_vim.network_rebalance._dhcp_rebalance import _run_state_machine
|
||||||
from nfv_vim.network_rebalance._dhcp_rebalance import add_rebalance_work_dhcp
|
from nfv_vim.network_rebalance._dhcp_rebalance import add_rebalance_work_dhcp
|
||||||
from nfv_vim.network_rebalance._dhcp_rebalance import DHCP_REBALANCE_STATE
|
from nfv_vim.network_rebalance._dhcp_rebalance import DHCP_REBALANCE_STATE
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
from . import utils # noqa: H304
|
from nfv_unit_tests.tests import utils
|
||||||
|
|
||||||
|
|
||||||
DEBUG_PRINTING = False
|
DEBUG_PRINTING = False
|
||||||
# DEBUG_PRINTING = True
|
MAX_AGENTS = 40
|
||||||
|
MAX_NETWORKS = 200
|
||||||
|
MAX_LOOPCOUNT = 2 * MAX_AGENTS * MAX_NETWORKS
|
||||||
|
|
||||||
_fake_host_table = dict()
|
_fake_host_table = dict()
|
||||||
|
|
||||||
|
@ -30,11 +33,6 @@ class _fake_host(object):
|
||||||
self.uuid = uuid
|
self.uuid = uuid
|
||||||
|
|
||||||
|
|
||||||
MAX_AGENTS = 40
|
|
||||||
MAX_NETWORKS = 200
|
|
||||||
MAX_LOOPCOUNT = 2 * MAX_AGENTS * MAX_NETWORKS
|
|
||||||
|
|
||||||
|
|
||||||
def build_get_agents_response():
|
def build_get_agents_response():
|
||||||
|
|
||||||
get_agents_response = dict()
|
get_agents_response = dict()
|
||||||
|
|
|
@ -16,7 +16,7 @@ from nfv_vim.objects import SW_UPDATE_ALARM_RESTRICTION
|
||||||
from nfv_vim.objects import SW_UPDATE_APPLY_TYPE
|
from nfv_vim.objects import SW_UPDATE_APPLY_TYPE
|
||||||
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
||||||
|
|
||||||
from . import sw_update_testcase # noqa: H304
|
from nfv_unit_tests.tests import sw_update_testcase
|
||||||
|
|
||||||
|
|
||||||
def create_fw_update_strategy(
|
def create_fw_update_strategy(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
# Copyright (c) 2016-2023 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
@ -23,8 +23,8 @@ from nfv_vim.tables._instance_table import InstanceTable
|
||||||
from nfv_vim.tables._instance_type_table import InstanceTypeTable
|
from nfv_vim.tables._instance_type_table import InstanceTypeTable
|
||||||
from nfv_vim.tables._table import Table
|
from nfv_vim.tables._table import Table
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
from . import utils # noqa: H304
|
from nfv_unit_tests.tests import utils
|
||||||
|
|
||||||
|
|
||||||
def fake_event_issue(a, b, c, d):
|
def fake_event_issue(a, b, c, d):
|
||||||
|
|
|
@ -13,8 +13,8 @@ from nfv_vim.directors._instance_director import InstanceDirector
|
||||||
from nfv_vim.tables._image_table import ImageTable
|
from nfv_vim.tables._image_table import ImageTable
|
||||||
from nfv_vim.tables._table import Table
|
from nfv_vim.tables._table import Table
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
from . import utils # noqa: H304
|
from nfv_unit_tests.tests import utils
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
_audit_interval = 330
|
_audit_interval = 330
|
||||||
|
|
|
@ -16,7 +16,7 @@ from nfv_vim.objects import SW_UPDATE_APPLY_TYPE
|
||||||
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
||||||
from nfv_vim.strategy._strategy import KubeRootcaUpdateStrategy
|
from nfv_vim.strategy._strategy import KubeRootcaUpdateStrategy
|
||||||
|
|
||||||
from . import sw_update_testcase # noqa: H304
|
from nfv_unit_tests.tests import sw_update_testcase
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('nfv_vim.event_log._instance._event_issue',
|
@mock.patch('nfv_vim.event_log._instance._event_issue',
|
||||||
|
|
|
@ -19,7 +19,7 @@ from nfv_vim.objects import SW_UPDATE_APPLY_TYPE
|
||||||
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
||||||
from nfv_vim.strategy._strategy import KubeUpgradeStrategy
|
from nfv_vim.strategy._strategy import KubeUpgradeStrategy
|
||||||
|
|
||||||
from . import sw_update_testcase # noqa: H304
|
from nfv_unit_tests.tests import sw_update_testcase
|
||||||
|
|
||||||
|
|
||||||
FROM_KUBE_VERSION = '1.2.3'
|
FROM_KUBE_VERSION = '1.2.3'
|
||||||
|
|
|
@ -11,7 +11,8 @@ from nfv_vim.network_rebalance._network_rebalance import _reschedule_down_agent
|
||||||
from nfv_vim.network_rebalance._network_rebalance import _reschedule_new_agent
|
from nfv_vim.network_rebalance._network_rebalance import _reschedule_new_agent
|
||||||
from nfv_vim.network_rebalance._network_rebalance import L3_REBALANCE_STATE
|
from nfv_vim.network_rebalance._network_rebalance import L3_REBALANCE_STATE
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
|
|
||||||
|
|
||||||
DEBUG_PRINTING = False
|
DEBUG_PRINTING = False
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ from nfv_vim.network_rebalance._network_rebalance import _run_state_machine
|
||||||
from nfv_vim.network_rebalance._network_rebalance import add_rebalance_work_l3
|
from nfv_vim.network_rebalance._network_rebalance import add_rebalance_work_l3
|
||||||
from nfv_vim.network_rebalance._network_rebalance import L3_REBALANCE_STATE
|
from nfv_vim.network_rebalance._network_rebalance import L3_REBALANCE_STATE
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
from . import utils # noqa:H304
|
from nfv_unit_tests.tests import utils
|
||||||
|
|
||||||
DEBUG_PRINTING = False
|
DEBUG_PRINTING = False
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from unittest import mock
|
||||||
|
|
||||||
from nfv_client import shell
|
from nfv_client import shell
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
|
|
||||||
|
|
||||||
class TestNFVClientShell(testcase.NFVTestCase):
|
class TestNFVClientShell(testcase.NFVTestCase):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from unittest import mock
|
||||||
|
|
||||||
from nfv_plugins.nfvi_plugins.clients import kubernetes_client
|
from nfv_plugins.nfvi_plugins.clients import kubernetes_client
|
||||||
|
|
||||||
from . import testcase # noqa: H304
|
from nfv_unit_tests.tests import testcase
|
||||||
|
|
||||||
|
|
||||||
def mock_load_kube_config(path):
|
def mock_load_kube_config(path):
|
||||||
|
|
|
@ -16,7 +16,7 @@ from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
|
||||||
from nfv_vim.objects import SwPatch
|
from nfv_vim.objects import SwPatch
|
||||||
from nfv_vim.strategy._strategy import SwPatchStrategy
|
from nfv_vim.strategy._strategy import SwPatchStrategy
|
||||||
|
|
||||||
from . import sw_update_testcase # noqa: H304
|
from nfv_unit_tests.tests import sw_update_testcase
|
||||||
|
|
||||||
|
|
||||||
def create_sw_patch_strategy(
|
def create_sw_patch_strategy(
|
||||||
|
|
|
@ -20,7 +20,7 @@ from nfv_vim.strategy._strategy import SwUpgradeStrategy
|
||||||
|
|
||||||
from nfv_vim.nfvi.objects.v1 import UPGRADE_STATE
|
from nfv_vim.nfvi.objects.v1 import UPGRADE_STATE
|
||||||
|
|
||||||
from . import sw_update_testcase # noqa: H304
|
from nfv_unit_tests.tests import sw_update_testcase
|
||||||
|
|
||||||
|
|
||||||
# utility method for the formatting of unlock-hosts stage as dict
|
# utility method for the formatting of unlock-hosts stage as dict
|
||||||
|
|
|
@ -131,19 +131,16 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
|
||||||
# W1406 redundant-u-string-prefix
|
# W1406 redundant-u-string-prefix
|
||||||
# W1505 Using deprecated method getargspec() (deprecated-method)
|
# W1505 Using deprecated method getargspec() (deprecated-method)
|
||||||
# W1514 unspecified-encoding
|
# W1514 unspecified-encoding
|
||||||
# W1618 no-absolute-import (Python3 checker)
|
|
||||||
# W0237 arguments-renamed
|
# W0237 arguments-renamed
|
||||||
# W4904 deprecated-class
|
# W4904 deprecated-class
|
||||||
# W4905 deprecated-decorator
|
# W4905 deprecated-decorator
|
||||||
|
|
||||||
# E0012 pylint for python3 does not support inline deprecation
|
|
||||||
# E1101 no-member
|
# E1101 no-member
|
||||||
# E1111 assignment-from-no-return
|
# E1111 assignment-from-no-return
|
||||||
# E1121 too-many-function-args
|
# E1121 too-many-function-args
|
||||||
disable=C, R, W0120, W0125, W0212, W0221, W0223, W0231, W0235,
|
disable=C, R, W0120, W0125, W0212, W0221, W0223, W0231, W0235,
|
||||||
W0401, W0404, W0511, W0602, W0603, W0612, W0613, W0621, W0622, W0703, W1401,
|
W0401, W0404, W0511, W0602, W0603, W0612, W0613, W0621, W0622, W0703, W1401,
|
||||||
W0107, W0706, W0707, W1310, W1406, W1505, W1514, W1618, W0237, W4904, W4905,
|
W0107, W0706, W0707, W1310, W1406, W1505, W1514, W0237, W4904, W4905,
|
||||||
E0012, E1101, E1111, E1121
|
E1101, E1111, E1121
|
||||||
|
|
||||||
[REPORTS]
|
[REPORTS]
|
||||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||||
|
|
|
@ -101,13 +101,14 @@ commands =
|
||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
deps = {[nfv]deps}
|
deps = {[nfv]deps}
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
{[nfv]nfv_test_dir}/nfv_unit_tests
|
||||||
{[nfv]nfv_test_dir}/nfv_scenario_tests
|
{[nfv]nfv_test_dir}/nfv_scenario_tests
|
||||||
jinja2
|
jinja2
|
||||||
commands = pylint {[nfv]nfv_client_src_dir} \
|
commands = pylint {[nfv]nfv_client_src_dir} \
|
||||||
{[nfv]nfv_common_src_dir} \
|
{[nfv]nfv_common_src_dir} \
|
||||||
{[nfv]nfv_plugins_src_dir} \
|
{[nfv]nfv_plugins_src_dir} \
|
||||||
{[nfv]nfv_vim_src_dir} \
|
{[nfv]nfv_vim_src_dir} \
|
||||||
{[nfv]nfv_test_src_dir} \
|
{[nfv]nfv_test_src_dir}/nfv_unit_tests \
|
||||||
--rcfile=./pylint.rc
|
--rcfile=./pylint.rc
|
||||||
|
|
||||||
[bandit]
|
[bandit]
|
||||||
|
|
Loading…
Reference in New Issue