From 0f31d9b7ac1bb01a3ff6ac396fe315cb657eef6f Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Thu, 24 Oct 2019 05:46:55 -0700 Subject: [PATCH] Remove skip_unless cruft (#7410) * Remove skip_unless cruft. * remove unused import --- acme/acme/test_util.py | 21 --------------------- certbot/tests/util.py | 20 -------------------- 2 files changed, 41 deletions(-) diff --git a/acme/acme/test_util.py b/acme/acme/test_util.py index f04829deb..6d9cbc8dc 100644 --- a/acme/acme/test_util.py +++ b/acme/acme/test_util.py @@ -4,7 +4,6 @@ """ import os -import unittest import pkg_resources from cryptography.hazmat.backends import default_backend @@ -73,23 +72,3 @@ def load_pyopenssl_private_key(*names): loader = _guess_loader( names[-1], crypto.FILETYPE_PEM, crypto.FILETYPE_ASN1) return crypto.load_privatekey(loader, load_vector(*names)) - - -def skip_unless(condition, reason): # pragma: no cover - """Skip tests unless a condition holds. - - This implements the basic functionality of unittest.skipUnless - which is only available on Python 2.7+. - - :param bool condition: If ``False``, the test will be skipped - :param str reason: the reason for skipping the test - - :rtype: callable - :returns: decorator that hides tests unless condition is ``True`` - - """ - if hasattr(unittest, "skipUnless"): - return unittest.skipUnless(condition, reason) - elif condition: - return lambda cls: cls - return lambda cls: None diff --git a/certbot/tests/util.py b/certbot/tests/util.py index c46623e0a..dfd752511 100644 --- a/certbot/tests/util.py +++ b/certbot/tests/util.py @@ -94,26 +94,6 @@ def load_pyopenssl_private_key(*names): return OpenSSL.crypto.load_privatekey(loader, load_vector(*names)) -def skip_unless(condition, reason): # pragma: no cover - """Skip tests unless a condition holds. - - This implements the basic functionality of unittest.skipUnless - which is only available on Python 2.7+. - - :param bool condition: If ``False``, the test will be skipped - :param str reason: the reason for skipping the test - - :rtype: callable - :returns: decorator that hides tests unless condition is ``True`` - - """ - if hasattr(unittest, "skipUnless"): - return unittest.skipUnless(condition, reason) - elif condition: - return lambda cls: cls - return lambda cls: None - - def make_lineage(config_dir, testfile): """Creates a lineage defined by testfile.