Skip to content

Commit 85558b7

Browse files
kszromek-nordicnvlsianpu
authored andcommitted
imgtool: fix dependency on click version
Signed-off-by: Krzysztof Szromek <krzysztof.szromek@nordicsemi.no>
1 parent 2d61c31 commit 85558b7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/tests/test_commands.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from importlib import metadata
16+
1517
import pytest
1618

1719
from click.testing import CliRunner
1820
from imgtool.main import imgtool
1921
from imgtool import imgtool_version
22+
from packaging.version import Version
2023

2124
# all available imgtool commands
2225
COMMANDS = [
@@ -53,7 +56,10 @@ def test_help():
5356

5457
# by default help should be also produced
5558
result_empty = runner.invoke(imgtool)
56-
assert result_empty.exit_code == 0
59+
60+
# return value without arguments differs based on click version
61+
expected_exit_code = 2 if Version(metadata.version("click")) >= Version("8.2.0") else 0
62+
assert result_empty.exit_code == expected_exit_code
5763
assert result_empty.output == result_short.output
5864

5965

0 commit comments

Comments
 (0)