X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Ftests%2Funit%2Fbenchmark%2Fscenarios%2Fnetworking%2Ftest_vnf_generic.py;h=64436eb4e9fc89bf74b2fabfeb17871276ad1b48;hb=bdfdad8f8c064228b11238bf33a02a57829d6993;hp=fb55b5ea0463cc328a3707a07ebd18fff93e1570;hpb=215740df982263cf3e2ae6581792856c365f0481;p=yardstick.git diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index fb55b5ea0..64436eb4e 100644 --- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # Copyright (c) 2016-2017 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +13,6 @@ # limitations under the License. # -# Unittest for yardstick.benchmark.scenarios.networking.test_vnf_generic - -from __future__ import absolute_import - import os import errno import unittest @@ -26,7 +20,6 @@ import mock from copy import deepcopy -from yardstick.tests.unit import STL_MOCKS from yardstick.benchmark.scenarios.networking.vnf_generic import \ SshManager, NetworkServiceTestCase, IncorrectConfig, \ open_relative_file @@ -35,10 +28,6 @@ from yardstick.network_services.vnf_generic.vnf.base import \ GenericTrafficGen, GenericVNF -# pylint: disable=unused-argument -# disable this for now because I keep forgetting mock patch arg ordering - - COMPLETE_TREX_VNFD = { 'vnfd:vnfd-catalog': { 'vnfd': [ @@ -425,16 +414,15 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test_get_vnf_imp(self): vnfd = COMPLETE_TREX_VNFD['vnfd:vnfd-catalog']['vnfd'][0]['class-name'] - with mock.patch.dict("sys.modules", STL_MOCKS): - self.assertIsNotNone(self.s.get_vnf_impl(vnfd)) + self.assertIsNotNone(self.s.get_vnf_impl(vnfd)) - with self.assertRaises(IncorrectConfig) as raised: - self.s.get_vnf_impl('NonExistentClass') + with self.assertRaises(IncorrectConfig) as raised: + self.s.get_vnf_impl('NonExistentClass') - exc_str = str(raised.exception) - print(exc_str) - self.assertIn('No implementation', exc_str) - self.assertIn('found in', exc_str) + exc_str = str(raised.exception) + print(exc_str) + self.assertIn('No implementation', exc_str) + self.assertIn('found in', exc_str) def test_load_vnf_models_invalid(self): self.context_cfg["nodes"]['tg__1']['VNF model'] = \ @@ -626,14 +614,13 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.s._get_traffic_imix()) def test__fill_traffic_profile(self): - with mock.patch.dict("sys.modules", STL_MOCKS): - self.scenario_cfg["traffic_profile"] = \ - self._get_file_abspath("ipv4_throughput_vpe.yaml") - self.scenario_cfg["traffic_options"]["flow"] = \ - self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") - self.scenario_cfg["traffic_options"]["imix"] = \ - self._get_file_abspath("imix_voice.yaml") - self.assertIsNotNone(self.s._fill_traffic_profile()) + self.scenario_cfg["traffic_profile"] = \ + self._get_file_abspath("ipv4_throughput_vpe.yaml") + self.scenario_cfg["traffic_options"]["flow"] = \ + self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") + self.scenario_cfg["traffic_options"]["imix"] = \ + self._get_file_abspath("imix_voice.yaml") + self.assertIsNotNone(self.s._fill_traffic_profile()) def test_teardown(self): vnf = mock.Mock(autospec=GenericVNF)