Skip to content

Commit

Permalink
Merge branch 'mock'
Browse files Browse the repository at this point in the history
PR #2062

* mock:
  Always use mock from stdlib
  Use unittest.mock instead of mock if available
  • Loading branch information
jamesls committed Dec 13, 2023
2 parents 65666d5 + 19b20fb commit 21c9562
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion requirements-test.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ coverage
websocket-client<2.0.0
pytest-cov
requests
mock
2 changes: 1 addition & 1 deletion tests/aws/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import time
import shutil
import uuid
from unittest import mock

import mock
import botocore.session
import pytest
import requests
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import os
import sys
import re
from unittest import mock

import pytest
from click.testing import CliRunner
import mock
from botocore.exceptions import ClientError

from chalice import cli
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cli/test_reloader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import mock
from unittest import mock
import threading
import os
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_awsclient.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import datetime
import time
from unittest import mock

import pytest
import mock
import botocore.exceptions
from botocore.vendored.requests import ConnectionError as \
RequestsConnectionError
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_deployer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import zipfile
import json
import mock
from unittest import mock
import hashlib

from pytest import fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import zipfile
import tarfile
import io
from unittest import mock
from collections import defaultdict, namedtuple

import pytest
import mock

from chalice.awsclient import TypedAWSClient
from chalice.config import Config
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cli/filewatch/test_eventbased.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import threading
from subprocess import Popen
from unittest import mock

import mock
import pytest

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock
import pytest
import re

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/deploy/test_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import botocore.session

import pytest
import mock
from unittest import mock
from botocore.stub import Stubber
from botocore.vendored.requests import ConnectionError as \
RequestsConnectionError
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/deploy/test_executor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
import mock
from unittest import mock
import pytest

from chalice.awsclient import TypedAWSClient
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/deploy/test_planner.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import mock

import pytest
from unittest import mock
from dataclasses import replace, dataclass
from typing import Tuple

import pytest

from chalice.awsclient import TypedAWSClient, ResourceDoesNotExistError
from chalice.deploy import models
from chalice.config import DeployedResources
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/deploy/test_swagger.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from unittest import mock

from chalice.deploy.swagger import (
SwaggerGenerator, CFNSwaggerGenerator, TerraformSwaggerGenerator)
from chalice import CORSConfig
from chalice.app import CustomAuthorizer, CognitoUserPoolAuthorizer
from chalice.app import IAMAuthorizer, Chalice
from chalice.deploy.models import RestAPI, IAMPolicy
import mock
from pytest import fixture


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/deploy/test_validate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import mock
from unittest import mock

from chalice.app import Chalice
from chalice.config import Config
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_local.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import re
import json
import decimal
from unittest import mock

import pytest
import mock
from pytest import fixture
from six import BytesIO
from six.moves.BaseHTTPServer import HTTPServer
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_logs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import time
import mock
from unittest import mock
from datetime import datetime, timedelta

from chalice import logs
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_package.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import json
import mock
from unittest import mock

import pytest
from chalice.config import Config
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import re
import mock
from unittest import mock
import sys

import click
Expand Down

0 comments on commit 21c9562

Please sign in to comment.