Skip to content

Commit

Permalink
Merge pull request #31 from InfrastructureAsCode-ch/bugfix/jsonpatch_…
Browse files Browse the repository at this point in the history
…lazy_import

Fix jsonpatch import warning
  • Loading branch information
ubaumann authored Apr 7, 2024
2 parents a50cb1b + 7932222 commit 9e8f6c4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nettowel/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.0" # From Makefile
__version__ = "0.6.1" # From Makefile
6 changes: 4 additions & 2 deletions nettowel/cli/jsonpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
)
from nettowel.exceptions import NettowelInputError

from nettowel import jsonpatch


app = get_typer_app(help="JSON Patch [RFC 6902](http://tools.ietf.org/html/rfc6902)")

Expand Down Expand Up @@ -52,6 +50,8 @@ def create(
False, "--print-result-only", help="Only print the result"
),
) -> None:
from nettowel import jsonpatch

try:
src = read_yaml(src_file_name)
dst = read_yaml(dst_file_name)
Expand Down Expand Up @@ -119,6 +119,8 @@ def apply(
False, "--print-result-only", help="Only print the result"
),
) -> None:
from nettowel import jsonpatch

try:
patch_data = read_yaml(patch_file_name)
data_input = read_yaml(data_file_name)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nettowel"
version = "0.6.0"
version = "0.6.1"
description = "Network Automation Collection"
authors = ["ubaumann <github@m.ubaumann.ch>"]
license = "Apache 2.0"
Expand Down
13 changes: 13 additions & 0 deletions tests/test_main_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from typer.testing import CliRunner
from nettowel.cli.main import app

runner = CliRunner(mix_stderr=False)


def test_help() -> None:
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0
assert "Awesome collection of network automation functions" in result.stdout
assert "Failed to import" not in result.stderr
assert not result.stderr
2 changes: 1 addition & 1 deletion tests/test_nettowel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version() -> None:
assert __version__ == "0.6.0" # From Makefile
assert __version__ == "0.6.1" # From Makefile

0 comments on commit 9e8f6c4

Please sign in to comment.