diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-04-16 09:46:39 +0200 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2022-06-03 19:17:19 -0400 |
commit | dc2547d62b7dfe7e5eb917585e0436f2f3a65a46 (patch) | |
tree | 0c1fa0a528f7c09b9dc17062fba35848f3624c9c /tests | |
parent | 7c54625f8fc21d8381ecb4a1af74f2db5da96da1 (diff) |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_config.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 5e9aa059..2095061f 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 @@ -705,6 +709,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")) |