Merge "Fix relative imports in nfv"

This commit is contained in:
Zuul 2023-01-25 19:34:00 +00:00 committed by Gerrit Code Review
commit 8f7fda26c1
22 changed files with 44 additions and 56 deletions

View File

@ -1,4 +1,4 @@
[DEFAULT]
test_path=./nfv-tests/nfv_unit_tests/tests
top_dir=.
top_dir=./nfv-tests

View File

@ -1,5 +0,0 @@
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

View File

@ -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
#
@ -23,7 +23,7 @@ from nfv_common import debug
from nfv_common import forensic
from nfv_plugins.nfvi_plugins import config
import tests # pylint: disable=relative-import
import tests
DLOG = debug.debug_get_logger('nfv_tests')

View File

@ -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
#
from setuptools import find_packages
from setuptools import setup
setup(
@ -12,7 +11,9 @@ setup(
version='1.0.0',
license='Apache-2.0',
platforms=['any'],
provides='nfv_scenario_tests',
provides=['nfv_scenario_tests'],
data_files=['./config.ini'],
packages=find_packages()
packages=['nfv_scenario_tests.tests'],
package_dir={'nfv_scenario_tests.tests': 'tests'},
scripts=['main.py']
)

View File

@ -1,5 +0,0 @@
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

View File

@ -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
#
from setuptools import find_packages
from setuptools import setup
setup(
@ -12,6 +11,7 @@ setup(
version='1.0.0',
license='Apache-2.0',
platforms=['any'],
provides='nfv_unit_tests',
packages=find_packages()
provides=['nfv_unit_tests'],
packages=['nfv_unit_tests.tests'],
package_dir={'nfv_unit_tests.tests': 'tests'}
)

View File

@ -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
#
@ -13,6 +13,7 @@ from nfv_vim import host_fsm
from nfv_vim import nfvi
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.tables._host_aggregate_table import HostAggregateTable
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._table import Table
from . import testcase # noqa: H304
from . import utils # noqa: H304
from nfv_unit_tests.tests import testcase
from nfv_unit_tests.tests import utils
from nfv_vim.objects import HOST_PERSONALITY
DEBUG_PRINTING = False

View File

@ -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
#
@ -11,7 +11,7 @@ import tempfile
from nfv_vim import database
from nfv_vim import tables
from . import testcase # noqa: H304
from nfv_unit_tests.tests import testcase
class TestNFVDatabaseUpgrade(testcase.NFVTestCase):

View File

@ -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 DHCP_REBALANCE_STATE
from . import testcase # noqa: H304
from . import utils # noqa: H304
from nfv_unit_tests.tests import testcase
from nfv_unit_tests.tests import utils
DEBUG_PRINTING = False
# DEBUG_PRINTING = True
MAX_AGENTS = 40
MAX_NETWORKS = 200
MAX_LOOPCOUNT = 2 * MAX_AGENTS * MAX_NETWORKS
_fake_host_table = dict()
@ -30,11 +33,6 @@ class _fake_host(object):
self.uuid = uuid
MAX_AGENTS = 40
MAX_NETWORKS = 200
MAX_LOOPCOUNT = 2 * MAX_AGENTS * MAX_NETWORKS
def build_get_agents_response():
get_agents_response = dict()

View File

@ -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_INSTANCE_ACTION
from . import sw_update_testcase # noqa: H304
from nfv_unit_tests.tests import sw_update_testcase
def create_fw_update_strategy(

View File

@ -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
#
@ -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._table import Table
from . import testcase # noqa: H304
from . import utils # noqa: H304
from nfv_unit_tests.tests import testcase
from nfv_unit_tests.tests import utils
def fake_event_issue(a, b, c, d):

View File

@ -13,8 +13,8 @@ from nfv_vim.directors._instance_director import InstanceDirector
from nfv_vim.tables._image_table import ImageTable
from nfv_vim.tables._table import Table
from . import testcase # noqa: H304
from . import utils # noqa: H304
from nfv_unit_tests.tests import testcase
from nfv_unit_tests.tests import utils
# Constants
_audit_interval = 330

View File

@ -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.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',

View File

@ -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.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'

View File

@ -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 L3_REBALANCE_STATE
from . import testcase # noqa: H304
from nfv_unit_tests.tests import testcase
DEBUG_PRINTING = False

View File

@ -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 L3_REBALANCE_STATE
from . import testcase # noqa: H304
from . import utils # noqa:H304
from nfv_unit_tests.tests import testcase
from nfv_unit_tests.tests import utils
DEBUG_PRINTING = False

View File

@ -9,7 +9,7 @@ from unittest import mock
from nfv_client import shell
from . import testcase # noqa: H304
from nfv_unit_tests.tests import testcase
class TestNFVClientShell(testcase.NFVTestCase):

View File

@ -12,7 +12,7 @@ from unittest import mock
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):

View File

@ -16,7 +16,7 @@ from nfv_vim.objects import SW_UPDATE_INSTANCE_ACTION
from nfv_vim.objects import SwPatch
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(

View File

@ -20,7 +20,7 @@ from nfv_vim.strategy._strategy import SwUpgradeStrategy
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

View File

@ -131,19 +131,16 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W1406 redundant-u-string-prefix
# W1505 Using deprecated method getargspec() (deprecated-method)
# W1514 unspecified-encoding
# W1618 no-absolute-import (Python3 checker)
# W0237 arguments-renamed
# W4904 deprecated-class
# W4905 deprecated-decorator
# E0012 pylint for python3 does not support inline deprecation
# E1101 no-member
# E1111 assignment-from-no-return
# E1121 too-many-function-args
disable=C, R, W0120, W0125, W0212, W0221, W0223, W0231, W0235,
W0401, W0404, W0511, W0602, W0603, W0612, W0613, W0621, W0622, W0703, W1401,
W0107, W0706, W0707, W1310, W1406, W1505, W1514, W1618, W0237, W4904, W4905,
E0012, E1101, E1111, E1121
W0107, W0706, W0707, W1310, W1406, W1505, W1514, W0237, W4904, W4905,
E1101, E1111, E1121
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -101,13 +101,14 @@ commands =
[testenv:pylint]
deps = {[nfv]deps}
-r{toxinidir}/test-requirements.txt
{[nfv]nfv_test_dir}/nfv_unit_tests
{[nfv]nfv_test_dir}/nfv_scenario_tests
jinja2
commands = pylint {[nfv]nfv_client_src_dir} \
{[nfv]nfv_common_src_dir} \
{[nfv]nfv_plugins_src_dir} \
{[nfv]nfv_vim_src_dir} \
{[nfv]nfv_test_src_dir} \
{[nfv]nfv_test_src_dir}/nfv_unit_tests \
--rcfile=./pylint.rc
[bandit]