diff --git a/acme/acme/crypto_util_test.py b/acme/acme/crypto_util_test.py index ea39fd0fa..58cb1cd69 100644 --- a/acme/acme/crypto_util_test.py +++ b/acme/acme/crypto_util_test.py @@ -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): diff --git a/acme/acme/messages_test.py b/acme/acme/messages_test.py index 4518da9b9..7124f8bd1 100644 --- a/acme/acme/messages_test.py +++ b/acme/acme/messages_test.py @@ -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: diff --git a/acme/acme/standalone_test.py b/acme/acme/standalone_test.py index fa0426563..4e93157d0 100644 --- a/acme/acme/standalone_test.py +++ b/acme/acme/standalone_test.py @@ -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): diff --git a/acme/acme/util_test.py b/acme/acme/util_test.py index 00aa8b02d..7bb308635 100644 --- a/acme/acme/util_test.py +++ b/acme/acme/util_test.py @@ -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.""" diff --git a/certbot-dns-rfc2136/certbot_dns_rfc2136/dns_rfc2136_test.py b/certbot-dns-rfc2136/certbot_dns_rfc2136/dns_rfc2136_test.py index 9d3a0fbfd..4af8ab9ef 100644 --- a/certbot-dns-rfc2136/certbot_dns_rfc2136/dns_rfc2136_test.py +++ b/certbot-dns-rfc2136/certbot_dns_rfc2136/dns_rfc2136_test.py @@ -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): diff --git a/certbot/tests/log_test.py b/certbot/tests/log_test.py index 87b12246e..f722f2c97 100644 --- a/certbot/tests/log_test.py +++ b/certbot/tests/log_test.py @@ -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): diff --git a/certbot/tests/main_test.py b/certbot/tests/main_test.py index 3aabb8d32..bf0e6b1ca 100644 --- a/certbot/tests/main_test.py +++ b/certbot/tests/main_test.py @@ -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):