From 95f2491ed89ac99b0d8bd006b4a13cbeb1eb96ce Mon Sep 17 00:00:00 2001 From: "Michael S. Pedersen" Date: Tue, 3 Dec 2019 11:38:32 +0000 Subject: NFVBENCH-153 Add support for python3 JIRA: NFVBENCH-153 Done using 2to3-3.6 with additional changes to fix data parsing and testing (tox) Signed-off-by: Michael S. Pedersen Change-Id: I242902f800da543d780507828c9bd1fbf409da6d --- test/mock_trex.py | 3 --- test/test_chains.py | 9 ++++----- test/test_nfvbench.py | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/mock_trex.py b/test/mock_trex.py index ed6b20e..4f0271a 100644 --- a/test/mock_trex.py +++ b/test/mock_trex.py @@ -30,8 +30,6 @@ except ImportError: class STLDummy(Exception): """Dummy class.""" - pass - trex_lib_mod = ModuleType('trex') sys.modules['trex'] = trex_lib_mod stl_lib_mod = ModuleType('trex.stl') @@ -77,4 +75,3 @@ except ImportError: def no_op(): """Empty function.""" - pass diff --git a/test/test_chains.py b/test/test_chains.py index 741bee7..3cf75cb 100644 --- a/test/test_chains.py +++ b/test/test_chains.py @@ -15,12 +15,12 @@ # """Test Chaining functions.""" -from mock_trex import no_op - from mock import MagicMock from mock import patch import pytest +from .mock_trex import no_op + from nfvbench.chain_runner import ChainRunner from nfvbench.chaining import ChainException from nfvbench.chaining import ChainVnfPort @@ -40,7 +40,6 @@ from nfvbench.traffic_client import TrafficClient from nfvbench.traffic_gen.traffic_base import Latency from nfvbench.traffic_gen.trex_gen import TRex - # just to get rid of the unused function warning no_op() @@ -157,7 +156,7 @@ def _test_pvp_chain_no_admin_no_config_values(config, cred, mock_glance, mock_ne runner.close() def test_pvp_chain_runner_no_admin_no_config_values(): - """Test PVP chain runner.""" + """Test PVP/mock chain runner.""" cred = MagicMock(spec=nfvbench.credentials.Credentials) cred.is_admin = False for shared_net in [True, False]: @@ -260,7 +259,7 @@ def _check_nfvbench_openstack(sc=ChainType.PVP, l2_loopback=False): nfvb = NFVBench(config, openstack_spec, config_plugin, factory) res = nfvb.run({}, 'pytest') if res['status'] != 'OK': - print res + print(res) assert res['status'] == 'OK' diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py index 7a0a9ed..4a8a574 100644 --- a/test/test_nfvbench.py +++ b/test/test_nfvbench.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. # -from mock_trex import no_op - import json import logging import sys @@ -34,6 +32,7 @@ from nfvbench.traffic_client import IpBlock from nfvbench.traffic_client import TrafficClient import nfvbench.traffic_gen.traffic_utils as traffic_utils +from .mock_trex import no_op # just to get rid of the unused function warning no_op() -- cgit 1.2.3-korg