Skip to content

Commit

Permalink
Bump packages, fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony House committed Apr 19, 2024
1 parent dab8f2d commit b6e0bbe
Show file tree
Hide file tree
Showing 8 changed files with 867 additions and 750 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: "ubuntu-20.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: "ubuntu-20.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
Expand Down
2 changes: 1 addition & 1 deletion napalm_panos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
# Import local modules
from napalm_panos.panos import PANOSDriver

__version__ = "0.6.0"
__version__ = "0.6.1"

__all__ = ("PANOSDriver",)
9 changes: 5 additions & 4 deletions napalm_panos/panos.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def _import_file(self, filename):
params=params,
headers={"Content-Type": mef.content_type},
data=mef,
timeout=5,
)
# if something goes wrong just raise an exception
request.raise_for_status()
Expand Down Expand Up @@ -266,7 +267,7 @@ def load_replace_candidate(self, filename=None, config=None):
raise ReplaceConfigException(f"Error while loading config from {path}")
self.loaded = True

def _get_file_content(self, filename): # pylint: disable=no-self-use
def _get_file_content(self, filename):
"""Convenience method to get file content."""
try:
with open(filename, "r", encoding="utf-8") as file:
Expand All @@ -279,7 +280,7 @@ def _send_merge_commands(self, config, file_config):
"""Netmiko is being used to push set commands."""
if self.loaded is False:
if self._save_backup() is False:
raise MergeConfigException("Error while storing backup " "config.")
raise MergeConfigException("Error while storing backup config.")
if self.ssh_connection is False:
self._open_ssh()

Expand Down Expand Up @@ -344,7 +345,7 @@ def load_merge_candidate(self, filename=None, config=None):
self._send_merge_commands(config, file_config)

else:
raise MergeConfigException("You must provide either a file " "or a set-format string")
raise MergeConfigException("You must provide either a file or a set-format string")

def compare_config(self):
"""Netmiko is being used to obtain config diffs because pan-python doesn't support the needed command."""
Expand Down Expand Up @@ -415,7 +416,7 @@ def rollback(self):
self.changed = False
self.merge_config = False
except Exception: # noqa pylint: disable=broad-except
ReplaceConfigException("Error while loading backup config")
raise ReplaceConfigException("Error while loading backup config")

def _extract_interface_list(self):
self.device.op(cmd="<show><interface>all</interface></show>")
Expand Down
1,557 changes: 833 additions & 724 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "napalm_panos"
version = "0.6.0"
version = "0.6.1"
description = "Network Automation and Programmability Abstraction Layer with Multivendor support for PANOS."
authors = ["Gabriele Gerbino <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -13,11 +13,10 @@ classifiers = [
"Intended Audience :: Developers",
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
include = [
"CHANGELOG.md",
Expand All @@ -27,7 +26,7 @@ include = [
]

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
python = ">=3.8,<3.12"
cryptography = "3.3.2"
napalm = "4.1.0"
lxml = "5.2.1"
Expand All @@ -37,13 +36,12 @@ requests-toolbelt = "*"
xmltodict = "*"


[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
bandit = "*"
black = {version="^21.10b0", python="^3.6.2"}
coverage = "*"
invoke = "*"
flake8 = "*"
pylint = {version="2.12.2", python="^3.6.2"}
pylint = "*"
pytest = "*"
pyyaml = "*"
pydocstyle = "*"
Expand All @@ -58,10 +56,12 @@ pytest-json = "*"
pytest-pythonpath = "*"
pylama = "*"
flake8-import-order = "*"
black = "*"


[tool.black]
line-length = 120
target-version = ['py37']
target-version = ['py38', 'py39', 'py310', 'py311']
include = '\.pyi?$'
exclude = '''
(
Expand Down Expand Up @@ -92,7 +92,6 @@ good-names="i,ip,j,k,ex,Run,_"
# Pylint and Black disagree about how to format multi-line arrays; Black wins.
disable = """,
line-too-long,
bad-continuation,
consider-iterating-dictionary,
too-many-statements,
"""
Expand All @@ -105,9 +104,10 @@ notes = """,
"""

[tool.pytest.ini_options]
python_paths = "./"
pythonpaths = "./"
testpaths = "tests/"
addopts = "-vv --doctest-modules -p no:warnings --ignore-glob='*mock*'"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
17 changes: 11 additions & 6 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tasks for use with Invoke."""

import os
import sys
from distutils.util import strtobool

from invoke import task

Expand All @@ -14,17 +14,22 @@
def is_truthy(arg):
"""Convert "truthy" strings into Booleans.
Args:
arg (str): Truthy string (True values are y, yes, t, true, on and 1; false values are n, no,
f, false, off and 0. Raises ValueError if val is anything else.
Examples:
>>> is_truthy('yes')
True
Args:
arg (str): Truthy string (True values are y, yes, t, true, on and 1; false values are n, no,
f, false, off and 0. Raises ValueError if val is anything else.
"""
if isinstance(arg, bool):
return arg
return bool(strtobool(arg))

val = str(arg).lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return True
if val in ("n", "no", "f", "false", "off", "0"):
return False
raise ValueError(f"Invalid truthy value: `{arg}`")


PYPROJECT_CONFIG = toml.load("pyproject.toml")
Expand Down
1 change: 1 addition & 0 deletions test/unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test fixtures."""

from builtins import super

from napalm.base.test import conftest as parent_conftest
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic test for version check."""

import os
import unittest

Expand Down

0 comments on commit b6e0bbe

Please sign in to comment.