mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 22:08:07 -04:00
Ignore ResourceWarnings in various modules in a 2-compatible way.
Sometimes tests are flaky about giving this warning, particularly in ACME. I recommend just ignoring them.
This commit is contained in:
parent
c699a50983
commit
36b6328acd
7 changed files with 31 additions and 10 deletions
|
|
@ -16,8 +16,9 @@ from acme import errors
|
|||
from acme import test_util
|
||||
from acme.magic_typing import List # pylint: disable=unused-import, no-name-in-module
|
||||
|
||||
# turns all warnings into errors for this module
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class SSLSocketAndProbeSNITest(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import unittest
|
|||
import josepy as jose
|
||||
import mock
|
||||
import pytest
|
||||
import six
|
||||
|
||||
from acme import challenges
|
||||
from acme import test_util
|
||||
|
|
@ -14,6 +15,10 @@ CERT = test_util.load_comparable_cert('cert.der')
|
|||
CSR = test_util.load_comparable_csr('csr.der')
|
||||
KEY = test_util.load_rsa_private_key('rsa512_key.pem')
|
||||
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class ErrorTest(unittest.TestCase):
|
||||
"""Tests for acme.messages.Error."""
|
||||
|
|
@ -167,7 +172,6 @@ class DirectoryTest(unittest.TestCase):
|
|||
from acme.messages import Directory
|
||||
Directory.from_json({'foo': 'bar'})
|
||||
|
||||
@pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
def test_iter_meta(self):
|
||||
result = False
|
||||
for k in self.dir.meta:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import threading
|
|||
import tempfile
|
||||
import unittest
|
||||
|
||||
import six
|
||||
from six.moves import http_client # pylint: disable=import-error
|
||||
from six.moves import queue # pylint: disable=import-error
|
||||
from six.moves import socketserver # type: ignore # pylint: disable=import-error
|
||||
|
|
@ -20,8 +21,9 @@ from acme import crypto_util
|
|||
from acme import test_util
|
||||
from acme.magic_typing import Set # pylint: disable=unused-import, no-name-in-module
|
||||
|
||||
# turns all warnings into errors for this module
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class TLSServerTest(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
"""Tests for acme.util."""
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
import six
|
||||
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class MapKeysTest(unittest.TestCase):
|
||||
"""Tests for acme.util.map_keys."""
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import dns.rcode
|
|||
import dns.tsig
|
||||
import mock
|
||||
import pytest
|
||||
import six
|
||||
|
||||
from certbot import errors
|
||||
from certbot.plugins import dns_test_common
|
||||
|
|
@ -20,6 +21,10 @@ NAME = 'a-tsig-key.'
|
|||
SECRET = 'SSB3b25kZXIgd2hvIHdpbGwgYm90aGVyIHRvIGRlY29kZSB0aGlzIHRleHQK'
|
||||
VALID_CONFIG = {"rfc2136_server": SERVER, "rfc2136_name": NAME, "rfc2136_secret": SECRET}
|
||||
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthenticatorTest):
|
||||
|
||||
|
|
@ -71,7 +76,7 @@ class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthentic
|
|||
self.auth.perform([self.achall])
|
||||
|
||||
|
||||
@pytest.mark.filterwarnings("ignore::ResourceWarning", "ignore:decodestring:DeprecationWarning")
|
||||
@pytest.mark.filterwarnings("ignore:decodestring:DeprecationWarning")
|
||||
class RFC2136ClientTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ from certbot import errors
|
|||
from certbot import util
|
||||
from certbot.tests import util as test_util
|
||||
|
||||
# turns all warnings into errors for this module
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class PreArgParseSetupTest(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -48,8 +48,9 @@ JWK = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
|
|||
RSA2048_KEY_PATH = test_util.vector_path('rsa2048_key.pem')
|
||||
SS_CERT_PATH = test_util.vector_path('cert_2048.pem')
|
||||
|
||||
# turns all warnings into errors for this module
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
# turns all ResourceWarnings into errors for this module
|
||||
if six.PY3:
|
||||
pytestmark = pytest.mark.filterwarnings("ignore::ResourceWarning")
|
||||
|
||||
|
||||
class TestHandleIdenticalCerts(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Reference in a new issue