128040
From 2dc654a20c4f1908d587060809a9d67b31352497 Mon Sep 17 00:00:00 2001
128040
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
128040
Date: Thu, 16 Apr 2020 09:46:39 +0200
128040
Subject: [PATCH] Skip tests requiring invoke if it's not installed
128040
128040
Since invoke is an optional dependency and only one group of tests
128040
require it, skip them gracefully rather than failing if it's not
128040
present.
128040
---
128040
 tests/test_config.py | 7 ++++++-
128040
 1 file changed, 6 insertions(+), 1 deletion(-)
128040
128040
diff --git a/tests/test_config.py b/tests/test_config.py
128040
index 5e9aa0592..2095061f2 100644
128040
--- a/tests/test_config.py
128040
+++ b/tests/test_config.py
128040
@@ -6,7 +6,11 @@
128040
 
128040
 from paramiko.py3compat import string_types
128040
 
128040
-from invoke import Result
128040
+try:
128040
+    from invoke import Result
128040
+except ImportError:
128040
+    Result = None
128040
+
128040
 from mock import patch
128040
 from pytest import raises, mark, fixture
128040
 
128040
@@ -705,6 +709,7 @@ def inner(command, *args, **kwargs):
128040
     return inner
128040
 
128040
 
128040
+@mark.skipif(Result is None, reason="requires invoke package")
128040
 class TestMatchExec(object):
128040
     @patch("paramiko.config.invoke", new=None)
128040
     @patch("paramiko.config.invoke_import_error", new=ImportError("meh"))