Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.12 support #1281

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4f64630
python3.12 support
chidanandpujar Nov 6, 2023
783aa34
python3.12 support
chidanandpujar Nov 17, 2023
fcfed1c
python3.12 support
chidanandpujar Nov 17, 2023
62a8d1d
python3.12 support
chidanandpujar Nov 17, 2023
7dc2c7b
python3.12 support
chidanandpujar Nov 17, 2023
e0bfb3a
python3.12 support
chidanandpujar Nov 17, 2023
d1d8bc8
python3.12 support
chidanandpujar Nov 17, 2023
8d76145
python3.12 support
chidanandpujar Nov 17, 2023
aad20f8
python3.12 support
chidanandpujar Nov 20, 2023
8deb3d0
python3.12 support
chidanandpujar Nov 29, 2023
cf682e3
python3.12 support
chidanandpujar Nov 29, 2023
945f44b
python3.12 support
chidanandpujar Nov 29, 2023
5373d70
python3.12 support
chidanandpujar Nov 29, 2023
9dae983
python3.12 support
chidanandpujar Nov 29, 2023
43dc209
python3.12 support
chidanandpujar Nov 29, 2023
0e39c64
python3.12 support
chidanandpujar Nov 29, 2023
c43b48c
python3.12 support
chidanandpujar Nov 29, 2023
7669f68
python3.12 support
chidanandpujar Nov 29, 2023
ae40448
python3.12 support
chidanandpujar Nov 29, 2023
c12a0fc
python3.12 support
chidanandpujar Nov 29, 2023
3bdc5b5
python3.12 support
chidanandpujar Nov 29, 2023
0bebe86
python3.12 support
chidanandpujar Nov 29, 2023
e9b183b
python3.12 support
chidanandpujar Nov 29, 2023
0e0614f
python3.12 support
chidanandpujar Nov 29, 2023
a8e2dff
python3.12 support
chidanandpujar Nov 29, 2023
5014e06
python3.12 support
chidanandpujar Nov 29, 2023
4d5b900
python3.12 support
chidanandpujar Nov 29, 2023
1420c9e
python3.12 support
chidanandpujar Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-20.04, windows-latest]
python-version: [3.9, '3.10', 3.11, 3.12]
exclude:
- os: windows-latest
python-version: 3.8
Expand All @@ -35,6 +35,7 @@ jobs:
pip install -r development.txt
pip install ntc_templates==1.4.1
pip install textfsm==0.4.1
pip install nose2
pip install .

- name: Run black tool
Expand All @@ -44,4 +45,7 @@ jobs:

- name: Run unit tests
run: |
nosetests -v --with-coverage --cover-package=jnpr.junos --cover-inclusive -a unit
echo $SHELL
uname -a
lsb_release -a
nose2 -vvv tests.unit
2 changes: 1 addition & 1 deletion lib/jnpr/junos/utils/scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, junos, **scpargs):
# User case also define progress with 3 params, the way scp module
# expects. Function will take path, total size, transferred.
# https://github.com/jbardin/scp.py/blob/master/scp.py#L97
spec = inspect.getargspec(self._user_progress)
spec = inspect.getfullargspec(self._user_progress)
if (len(spec.args) == 3 and spec.args[0] != "self") or (
len(spec.args) == 4 and spec.args[0] == "self"
):
Expand Down
2 changes: 1 addition & 1 deletion lib/jnpr/junos/utils/start_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def open(self):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
close_fds=1,
bufsize=1,
bufsize=0,
)
else:
self._client = open_ssh_client(dev=self._nc)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lxml>=3.2.4
# ncclient version 0.6.10 has issues with PyEZ(junos-eznc) and needs to be avoided
ncclient==0.6.13
ncclient>=0.6.15
paramiko>=1.15.2
scp>=0.7.0
jinja2>=2.7.1
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import unittest
import sys

from nose.plugins.attrib import attr
import nose2
from mock import patch

__author__ = "Nitin Kumar"
__credits__ = "Jeremy Schulman"


@attr("unit")

class TestJunosInit(unittest.TestCase):
def test_warning(self):
with patch.object(sys.modules["sys"], "version_info", (2, 6, 3)) as mock_sys:
with patch.object(sys.modules["sys"], "version_info", (2, 6, 8)) as mock_sys:
from jnpr import junos

self.assertEqual(mock_sys, (2, 6, 3))
self.assertEqual(mock_sys, (2, 6, 8))
4 changes: 2 additions & 2 deletions tests/unit/factory/test_cfgtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import sys

from nose.plugins.attrib import attr
import nose2
import yaml

from jnpr.junos import Device
Expand Down Expand Up @@ -85,7 +85,7 @@
globals().update(FactoryLoader().load(yaml.load(yaml_bgp_data, Loader=yaml.FullLoader)))


@attr("unit")

@unittest.skipIf(sys.platform == "win32", "will work for windows in coming days")
class TestFactoryCfgTable(unittest.TestCase):
@patch("ncclient.manager.connect")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_cmdtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import os
from nose.plugins.attrib import attr
import nose2

from jnpr.junos import Device
from jnpr.junos.exception import RpcError
Expand All @@ -17,7 +17,7 @@
import json


@attr("unit")

class TestFactoryCMDTable(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_factory_cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
__credits__ = "Jeremy Schulman"

import unittest
from nose.plugins.attrib import attr
import nose2

from jnpr.junos.factory.factory_cls import FactoryCfgTable, FactoryOpTable
from jnpr.junos.factory.factory_cls import FactoryTable, FactoryView


@attr("unit")

class TestFactoryCls(unittest.TestCase):
def test_factory_cls_cfgtable(self):
t = FactoryCfgTable()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_factory_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
__credits__ = "Jeremy Schulman"

import unittest
from nose.plugins.attrib import attr
import nose2
from jnpr.junos.factory import FactoryLoader
from mock import patch


@attr("unit")

class TestFactoryLoader(unittest.TestCase):
def setUp(self):
self.fl = FactoryLoader()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_optable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import yaml
import json
from nose.plugins.attrib import attr
import nose2

from jnpr.junos import Device
from jnpr.junos.op.phyport import PhyPortStatsTable
Expand All @@ -22,7 +22,7 @@
from mock import patch


@attr("unit")

class TestFactoryOpTable(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman"

import unittest
from nose.plugins.attrib import attr
import nose2
import os

from jnpr.junos import Device
Expand All @@ -23,7 +23,7 @@
builtin_string = "builtins"


@attr("unit")

class TestFactoryTable(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest2 as unittest
except ImportError:
import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch
import os
import json
Expand All @@ -21,7 +21,7 @@
from ncclient.operations.rpc import RPCReply


@attr("unit")

class TestToJson(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
__credits__ = "Jeremy Schulman"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import MagicMock, patch
from jnpr.junos import Device
from jnpr.junos.factory.view import View
from jnpr.junos.op.phyport import PhyPortStatsTable, PhyPortStatsView
from lxml import etree


@attr("unit")

class TestFactoryView(unittest.TestCase):
def setUp(self):
self.dev = Device(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/factory/test_view_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
__credits__ = "Jeremy Schulman"

import unittest
from nose.plugins.attrib import attr
import nose2

from jnpr.junos.factory.viewfields import ViewFields


@attr("unit")

class TestFactoryViewFields(unittest.TestCase):
def setUp(self):
self.vf = ViewFields()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import unittest2 as unittest
except ImportError:
import unittest
from nose.plugins.attrib import attr
import nose2
import importlib
import sys

import jnpr.junos.facts


@attr("unit")

class TestFactInitialization(unittest.TestCase):
def test_duplicate_facts(self):
module = importlib.import_module("tests.unit.facts.dupe_foo1")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_current_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -14,7 +14,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestCurrentRe(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -14,7 +14,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestDomain(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_ethernet_mac_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -14,7 +14,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestEthernetMacTable(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os

Expand All @@ -12,7 +12,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestFileList(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_get_chassis_cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -14,7 +14,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestGetChassisClusterStatus(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_get_chassis_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os

Expand All @@ -12,7 +12,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestChassis(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_get_route_engine_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -13,7 +13,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestGetRouteEngineInformation(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/facts/test_get_software_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman, Nitin Kumar"

import unittest
from nose.plugins.attrib import attr
import nose2
from mock import patch, MagicMock
import os
from lxml import etree
Expand All @@ -14,7 +14,7 @@
from ncclient.transport import SSHSession


@attr("unit")

class TestGetSoftwareInformation(unittest.TestCase):
@patch("ncclient.manager.connect")
def setUp(self, mock_connect):
Expand Down
Loading
Loading