From 529558cc20e448e45e24dc7b7609cd62300838b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 16 Apr 2020 09:46:39 +0200 Subject: [PATCH] Skip tests requiring invoke if it's not installed Since invoke is an optional dependency and only one group of tests require it, skip them gracefully rather than failing if it's not present. --- tests/test_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_config.py b/tests/test_config.py index 45fb262d..017d4bbf 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -6,7 +6,11 @@ from socket import gaierror from paramiko.py3compat import string_types -from invoke import Result +try: + from invoke import Result +except ImportError: + Result = None + from mock import patch from pytest import raises, mark, fixture @@ -742,6 +746,7 @@ def _expect(success_on): return inner +@mark.skipif(Result is None, reason="requires invoke package") class TestMatchExec(object): @patch("paramiko.config.invoke", new=None) @patch("paramiko.config.invoke_import_error", new=ImportError("meh")) -- 2.35.1