From 8c90684b276d994d09b3dc0d5a030900bbb39929 Mon Sep 17 00:00:00 2001 From: Franza Cavalcante Date: Thu, 20 Jun 2019 16:46:18 -0600 Subject: Python3 support to gobgp tests This PR removes dependencies on old Fabric version, as it's not supported by Python3. The current Fabric versions don't support the colors and indent used previously, so we found substitute methods from other libraries and defined these in the library files. The local function from fabric is now just a wrapper to invoke's run function. All the files were processed through 2to3 command. All the tests were executed and we don't see any difference on the outputs when running Python2 or Python3. The creation of gobgp container is removed from base.py into fabfile.py, in order to comply with Fabric2 changes and simplify dependencies. --- test/scenario_test/bgp_unnumbered_test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/scenario_test/bgp_unnumbered_test.py') diff --git a/test/scenario_test/bgp_unnumbered_test.py b/test/scenario_test/bgp_unnumbered_test.py index 42aec3b9..7ebb50da 100644 --- a/test/scenario_test/bgp_unnumbered_test.py +++ b/test/scenario_test/bgp_unnumbered_test.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import + import unittest -from fabric.api import local from lib import base -from lib.base import BGP_FSM_ESTABLISHED +from lib.base import BGP_FSM_ESTABLISHED, local from lib.gobgp import GoBGPContainer import sys import os @@ -92,7 +91,7 @@ class GoBGPTestBase(unittest.TestCase): if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) if int(output) is not 0: - print "docker not found" + print("docker not found") sys.exit(1) nose.main(argv=sys.argv, addplugins=[OptionParser()], -- cgit v1.2.3