aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-12-06 09:32:45 -0800
committerOle Trøan <otroan@employees.org>2018-12-06 19:22:50 +0000
commitf0cbcea428e8ffe6018ea782df9ebe9eb5b08dd0 (patch)
treea6d25e7f8afd69bbf923c348ec0100e04bb3ff89 /test
parent10c5ff143a86d15e78cb1f8625eb0ab8bf72b6ce (diff)
Test framework: fix import logic for sphynx.
* Simplify conditional import. Remove global variable. * Fix vpp_l2 import side effect. Change-Id: I3945cf2a0cf8844004af2cd636f92d73ddc60f93 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test')
-rw-r--r--test/vpp_papi_provider.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 6cbde71633e..8153e031607 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -6,22 +6,19 @@ from collections import deque
from six import moves
from hook import Hook
+from vpp_l2 import L2_PORT_TYPE
# Sphinx creates auto-generated documentation by importing the python source
# files and collecting the docstrings from them. The NO_VPP_PAPI flag allows
# the vpp_papi_provider.py file to be importable without having to build
# the whole vpp api if the user only wishes to generate the test documentation.
-do_import = True
-try:
- no_vpp_papi = os.getenv("NO_VPP_PAPI")
- if no_vpp_papi == "1":
- do_import = False
-except:
- pass
-if do_import:
+try:
from vpp_papi import VPP
- from vpp_l2 import L2_PORT_TYPE
+except ImportError:
+ if not os.getenv("NO_VPP_PAPI") == 1:
+ raise
+ pass
# from vnet/vnet/mpls/mpls_types.h
MPLS_IETF_MAX_LABEL = 0xfffff