Skip to content

Commit

Permalink
Remove external mock dependency (certbot#9331)
Browse files Browse the repository at this point in the history
* Remove external mock dependency

This also removes the "external-mock" test environment

* remove superfluous ignores

* remove mock warning ignore from pytest.ini

* drop deps on mock in oldest, drop dep on types-mock

Co-authored-by: Alex Zorin <[email protected]>
  • Loading branch information
wgreenberg and alexzorin authored Sep 28, 2022
1 parent c9eba6c commit 26d479d
Show file tree
Hide file tree
Showing 82 changed files with 79 additions and 388 deletions.
2 changes: 0 additions & 2 deletions .azure-pipelines/templates/jobs/extended-tests-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
PYTHON_VERSION: 3.7
TOXENV: py37
CERTBOT_NO_PIN: 1
linux-external-mock:
TOXENV: external-mock
linux-boulder-v2-integration-certbot-oldest:
PYTHON_VERSION: 3.7
TOXENV: integration-certbot-oldest
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/augeasnode_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
"""Tests for AugeasParserNode classes"""
from typing import List

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

import os
import util
from unittest import mock

from certbot import errors

Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/autohsts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"""Test for certbot_apache._internal.configurator AutoHSTS functionality"""
import re
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot_apache._internal import constants
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/centos_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Test for certbot_apache._internal.configurator for Centos overrides"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import filesystem
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/configurator_reverter_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"""Test for certbot_apache._internal.configurator implementations of reverter"""
import shutil
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
import util
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/configurator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
import socket
import tempfile
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from acme import challenges
from certbot import achallenges
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/debian_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"""Test for certbot_apache._internal.configurator for Debian overrides"""
import shutil
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import os
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/display_ops_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Test certbot_apache._internal.display_ops."""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.display import util as display_util
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/dualnode_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Tests for DualParserNode implementation"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot_apache._internal import assertions
from certbot_apache._internal import augeasparser
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/entrypoint_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Test for certbot_apache._internal.entrypoint for override class resolution"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/fedora_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Test for certbot_apache._internal.configurator for Fedora 29+ overrides"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import filesystem
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/gentoo_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Test for certbot_apache._internal.configurator for Gentoo overrides"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import filesystem
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/http_01_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import unittest
import errno
from typing import List

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from acme import challenges
from certbot import achallenges
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/parser_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"""Tests for certbot_apache._internal.parser."""
import shutil
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import os
Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/parsernode_configurator_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Tests for ApacheConfigurator for AugeasParserNode classes"""
import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

import util

Expand Down
6 changes: 1 addition & 5 deletions certbot-apache/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

import augeas
import josepy as jose

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot.compat import os
from certbot.plugins import common
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-cloudflare/tests/dns_cloudflare_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"""Tests for certbot_dns_cloudflare._internal.dns_cloudflare."""

import unittest
from unittest import mock

import CloudFlare
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-digitalocean/tests/dns_digitalocean_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
"""Tests for certbot_dns_digitalocean._internal.dns_digitalocean."""

import unittest
from unittest import mock

import digitalocean
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-dnsimple/tests/dns_dnsimple_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_dnsimple._internal.dns_dnsimple."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-dnsmadeeasy/tests/dns_dnsmadeeasy_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_dnsmadeeasy._internal.dns_dnsmadeeasy."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-gehirn/tests/dns_gehirn_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_gehirn._internal.dns_gehirn."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
6 changes: 2 additions & 4 deletions certbot-dns-google/tests/dns_google_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
from googleapiclient.errors import Error
from googleapiclient.http import HttpMock
from httplib2 import ServerNotFoundError
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from unittest import mock

from certbot import errors
from certbot.compat import os
Expand Down
6 changes: 1 addition & 5 deletions certbot-dns-linode/tests/dns_linode_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"""Tests for certbot_dns_linode._internal.dns_linode."""

import unittest

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from unittest import mock

from certbot import errors
from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-luadns/tests/dns_luadns_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_luadns._internal.dns_luadns."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-nsone/tests/dns_nsone_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_nsone._internal.dns_nsone."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-ovh/tests/dns_ovh_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_ovh._internal.dns_ovh."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-rfc2136/tests/dns_rfc2136_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
"""Tests for certbot_dns_rfc2136._internal.dns_rfc2136."""

import unittest
from unittest import mock

import dns.flags
import dns.rcode
import dns.tsig
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-route53/tests/dns_route53_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
"""Tests for certbot_dns_route53._internal.dns_route53.Authenticator"""

import unittest
from unittest import mock

from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-dns-sakuracloud/tests/dns_sakuracloud_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_dns_sakuracloud._internal.dns_sakuracloud."""

import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError

from certbot.compat import os
Expand Down
5 changes: 1 addition & 4 deletions certbot-nginx/tests/configurator_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""Test for certbot_nginx._internal.configurator."""
import unittest
from unittest import mock

try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
import OpenSSL

from acme import challenges
Expand Down
5 changes: 1 addition & 4 deletions certbot-nginx/tests/http_01_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Tests for certbot_nginx._internal.http_01"""
import unittest
from unittest import mock

import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore

from acme import challenges
from certbot import achallenges
Expand Down
Loading

0 comments on commit 26d479d

Please sign in to comment.