From 8e584055cf1b7dcfa7497fc1a5c1a937199428b7 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Wed, 3 Apr 2019 10:11:44 +0700 Subject: [PATCH 1/2] conftest.py: Ignore KeyboardInterrupt During check_internet() and check_github_ssh(), a KeyboardInterrupt should be interpreted as user desire to escape the check, not escape the entire test run. This is especially true during check_github_ssh which may require a passphrase from the user, which they might feel uncomfortable giving during a test suite. After these checks are bypassed, there is user feedback indicating the tests are running, and so they can trigger KeyboardInterrupt again if they wish to escape the entire test run. --- tests/integration/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 766291e8..d6d0aded 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -38,6 +38,10 @@ def check_internet(): for url in ("http://httpbin.org/ip", "http://clients3.google.com/generate_204"): try: try_internet(url) + except KeyboardInterrupt: + warnings.warn( + "Skipped connecting to internet: {0}".format(url), RuntimeWarning + ) except Exception: warnings.warn( "Failed connecting to internet: {0}".format(url), RuntimeWarning @@ -58,6 +62,10 @@ def check_github_ssh(): # return_code=255 and say 'Permission denied (publickey).' c = delegator.run('ssh -T git@github.com') res = True if c.return_code == 1 else False + except KeyboardInterrupt: + warnings.warn( + "KeyboardInterrupt while checking GitHub ssh access", RuntimeWarning + ) except Exception: pass global HAS_WARNED_GITHUB From 9feb0e08ec3233d6f99c807f0ae0418533b0ca27 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Wed, 3 Apr 2019 12:08:30 +0700 Subject: [PATCH 2/2] Add news entry --- news/3669.trivial.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3669.trivial.rst diff --git a/news/3669.trivial.rst b/news/3669.trivial.rst new file mode 100644 index 00000000..86ff9280 --- /dev/null +++ b/news/3669.trivial.rst @@ -0,0 +1 @@ +Allow KeyboardInterrupt to cancel test suite checks for working internet and ssh