summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2020-02-04 13:28:13 +0100
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2020-02-07 16:53:29 +0000
commit6e6ad64a4cc97f9f777891c0349bbb129ab03013 (patch)
tree2ee392cf6e9f94b3a650d63063824af34f35213e
parentdc90c719bca27856101f758939dcfb0b67124775 (diff)
tests: support python 3.8
Make test framework python3 version independence. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I1ef1eb77b6c1f422ebc4dad0818f87c8e587b34b
-rw-r--r--test/Makefile4
-rw-r--r--test/framework.py3
-rw-r--r--test/test_ip6.py2
-rw-r--r--test/vpp_ip_route.py6
4 files changed, 7 insertions, 8 deletions
diff --git a/test/Makefile b/test/Makefile
index cbdcff1a2d5..244822beb08 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -93,7 +93,7 @@ VENV_RUN_DIR:=$(VENV_PATH)/run
endif
ifeq ($(PYTHON),)
-PYTHON_INTERP=python3.6
+PYTHON_INTERP=python3
else
PYTHON_INTERP=$(PYTHON)
endif
@@ -102,7 +102,7 @@ PYTHON_VERSION=$(shell $(PYTHON_INTERP) -c 'import sys; print(sys.version_info.m
PIP_VERSION=19.1.1
PIP_TOOLS_VERSION=3.8.0 # Keep in sync with requirements.txt
PYTHON_DEPENDS=requirements-$(PYTHON_VERSION).txt
-SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/$(PYTHON_INTERP) -name site-packages)
+SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/python* -name site-packages)
BUILD_COV_DIR=$(TEST_BR)/coverage
PIP_TOOLS_INSTALL_DONE=$(VENV_RUN_DIR)/pip-tools-install-$(PYTHON_VERSION).done
diff --git a/test/framework.py b/test/framework.py
index ba4576518b9..872dd45d86b 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -446,8 +446,7 @@ class VppTestCase(unittest.TestCase):
try:
cls.vpp = subprocess.Popen(cmdline,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- bufsize=1)
+ stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
cls.logger.critical("Subprocess returned with non-0 return code: ("
"%s)", e.returncode)
diff --git a/test/test_ip6.py b/test/test_ip6.py
index f5904d9a3bd..04db7e52b38 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1278,7 +1278,7 @@ class TestIPv6RDControlPlane(TestIPv6ND):
while (n_tries):
fib = self.vapi.ip_route_dump(0, True)
default_routes = self.get_default_routes(fib)
- if 0 is len(default_routes):
+ if 0 == len(default_routes):
return True
n_tries = n_tries - 1
self.sleep(s_time)
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 3ac0e84c58a..67183d943c8 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -87,7 +87,7 @@ def ip_to_dpo_proto(addr):
def address_proto(ip_addr):
- if ip_addr.ip_addr.version is 4:
+ if ip_addr.ip_addr.version == 4:
return FibPathProto.FIB_PATH_NH_PROTO_IP4
else:
return FibPathProto.FIB_PATH_NH_PROTO_IP6
@@ -96,7 +96,7 @@ def address_proto(ip_addr):
def find_route(test, addr, len, table_id=0):
prefix = mk_network(addr, len)
- if 4 is prefix.version:
+ if 4 == prefix.version:
routes = test.vapi.ip_route_dump(table_id, False)
else:
routes = test.vapi.ip_route_dump(table_id, True)
@@ -131,7 +131,7 @@ def find_mroute(test, grp_addr, src_addr, grp_addr_len,
text_type(grp_addr),
grp_addr_len)
- if 4 is ip_mprefix.version:
+ if 4 == ip_mprefix.version:
routes = test.vapi.ip_mroute_dump(table_id, False)
else:
routes = test.vapi.ip_mroute_dump(table_id, True)