Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Update test status to reflect NAPALM distributions that have release Python3 support #177

Merged
merged 12 commits into from
Jan 5, 2017
11 changes: 8 additions & 3 deletions napalm_base/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from __future__ import print_function
from __future__ import unicode_literals

from napalm_base.utils import py23_compat


def test_model(model, data):
"""Return if the dictionary `data` complies with the `model`."""
Expand All @@ -14,9 +16,12 @@ def test_model(model, data):

correct_class = True
for key, instance_class in model.items():
same_class = isinstance(data[key], instance_class)
correct_class = correct_class and same_class
if not same_class:
correct_class = isinstance(data[key], instance_class)
# Properly handle PY2 long
if py23_compat.PY2:
if isinstance(data[key], long) and isinstance(1, instance_class): # noqa
correct_class = True
if not correct_class:
print("key: {}\nmodel_class: {}\ndata_class: {}".format(
key, instance_class, data[key].__class__))

Expand Down
8 changes: 5 additions & 3 deletions test/unit/TestGetNetworkDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
class TestGetNetworkDriver(unittest.TestCase):
"""Test the method get_network_driver."""

drivers_common = ('eos', 'ios', 'iosxr', 'IOS-XR', 'junos', 'ros', 'nxos',
'pluribus', 'panos', 'vyos')
drivers_py2_only = ('fortios', 'ibm')
if PY2:
# All drivers support python2
network_drivers = ('eos', 'eos', 'fortios', 'ibm', 'ios', 'iosxr', 'IOS-XR', 'junos',
'nxos', 'pluribus', 'panos')
network_drivers = drivers_common + drivers_py2_only
elif PY3:
# Drivers that support python2 and python3
network_drivers = ('ios',)
network_drivers = drivers_common

@data(*network_drivers)
def test_get_network_driver(self, driver):
Expand Down
4 changes: 3 additions & 1 deletion test/unit/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ napalm-iosxr
napalm-junos
napalm-nxos
napalm-pluribus
napalm-panos
napalm-panos
napalm-ros
napalm-vyos
8 changes: 8 additions & 0 deletions test/unit/requirements_py3.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
ddt
lxml
napalm-eos
napalm-ios
napalm-iosxr
napalm-junos
napalm-nxos
napalm-panos
napalm-pluribus
napalm-ros
napalm-vyos