mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 17:54:25 +02:00
Remove skip_unless cruft (#7410)
* Remove skip_unless cruft. * remove unused import
This commit is contained in:
committed by
Adrien Ferrand
parent
60673e8a81
commit
0f31d9b7ac
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import unittest
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
@@ -73,23 +72,3 @@ def load_pyopenssl_private_key(*names):
|
|||||||
loader = _guess_loader(
|
loader = _guess_loader(
|
||||||
names[-1], crypto.FILETYPE_PEM, crypto.FILETYPE_ASN1)
|
names[-1], crypto.FILETYPE_PEM, crypto.FILETYPE_ASN1)
|
||||||
return crypto.load_privatekey(loader, load_vector(*names))
|
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
|
|
||||||
|
|||||||
@@ -94,26 +94,6 @@ def load_pyopenssl_private_key(*names):
|
|||||||
return OpenSSL.crypto.load_privatekey(loader, load_vector(*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):
|
def make_lineage(config_dir, testfile):
|
||||||
"""Creates a lineage defined by testfile.
|
"""Creates a lineage defined by testfile.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user