Skip to content

Commit 9e8f6c4

Browse files
authored
Merge pull request #31 from InfrastructureAsCode-ch/bugfix/jsonpatch_lazy_import
Fix jsonpatch import warning
2 parents a50cb1b + 7932222 commit 9e8f6c4

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

nettowel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.6.0" # From Makefile
1+
__version__ = "0.6.1" # From Makefile

nettowel/cli/jsonpatch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
)
1414
from nettowel.exceptions import NettowelInputError
1515

16-
from nettowel import jsonpatch
17-
1816

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

@@ -52,6 +50,8 @@ def create(
5250
False, "--print-result-only", help="Only print the result"
5351
),
5452
) -> None:
53+
from nettowel import jsonpatch
54+
5555
try:
5656
src = read_yaml(src_file_name)
5757
dst = read_yaml(dst_file_name)
@@ -119,6 +119,8 @@ def apply(
119119
False, "--print-result-only", help="Only print the result"
120120
),
121121
) -> None:
122+
from nettowel import jsonpatch
123+
122124
try:
123125
patch_data = read_yaml(patch_file_name)
124126
data_input = read_yaml(data_file_name)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nettowel"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
description = "Network Automation Collection"
55
authors = ["ubaumann <[email protected]>"]
66
license = "Apache 2.0"

tests/test_main_cli.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
from typer.testing import CliRunner
3+
from nettowel.cli.main import app
4+
5+
runner = CliRunner(mix_stderr=False)
6+
7+
8+
def test_help() -> None:
9+
result = runner.invoke(app, ["--help"])
10+
assert result.exit_code == 0
11+
assert "Awesome collection of network automation functions" in result.stdout
12+
assert "Failed to import" not in result.stderr
13+
assert not result.stderr

tests/test_nettowel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

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

0 commit comments

Comments
 (0)