[AIRFLOW-4215] Replace mock with unittest.mock (#5292)
This commit is contained in:
Родитель
ba46d87f93
Коммит
577f893672
1
setup.py
1
setup.py
|
@ -260,7 +260,6 @@ devel = [
|
|||
'flake8>=3.6.0',
|
||||
'freezegun',
|
||||
'jira',
|
||||
'mock;python_version<"3.3"',
|
||||
'mongomock',
|
||||
'moto==1.3.5',
|
||||
'nose',
|
||||
|
|
|
@ -21,7 +21,7 @@ import json
|
|||
import unittest
|
||||
|
||||
from freezegun import freeze_time
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import AirflowException
|
||||
from airflow import models
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
import json
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import sys
|
|||
import unittest
|
||||
|
||||
from datetime import datetime, timedelta, time
|
||||
from mock import patch, Mock, MagicMock
|
||||
from unittest.mock import patch, Mock, MagicMock
|
||||
from time import sleep
|
||||
import psutil
|
||||
import pytz
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import json
|
||||
import unittest
|
||||
from collections import namedtuple
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.models import Connection
|
||||
|
|
|
@ -22,7 +22,7 @@ import unittest
|
|||
from typing import List
|
||||
|
||||
from google.auth.exceptions import GoogleAuthError
|
||||
import mock
|
||||
from unittest import mock
|
||||
from googleapiclient.errors import HttpError
|
||||
|
||||
from airflow.contrib.hooks import bigquery_hook as hook
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
import json
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.exceptions import AirflowException
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
import unittest
|
||||
|
||||
from airflow.contrib.hooks.datastore_hook import DatastoreHook
|
||||
from mock import call, patch
|
||||
from unittest.mock import call, patch
|
||||
|
||||
from tests.compat import mock
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import six
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import json
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import requests
|
||||
from google.auth.exceptions import GoogleAuthError
|
||||
from googleapiclient.discovery import build_from_document
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import imaplib
|
||||
import unittest
|
||||
|
||||
from mock import Mock, patch, mock_open
|
||||
from unittest.mock import Mock, patch, mock_open
|
||||
|
||||
from airflow import configuration, AirflowException
|
||||
from airflow.contrib.hooks.imap_hook import ImapHook
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
import unittest
|
||||
import json
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.hooks.jdbc_hook import JdbcHook
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.contrib.hooks.jira_hook import JiraHook
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.contrib.hooks.pinot_hook import PinotDbApiHook
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
import unittest
|
||||
|
||||
import pandas as pd
|
||||
from mock import patch, Mock
|
||||
from unittest.mock import patch, Mock
|
||||
from simple_salesforce import Salesforce
|
||||
|
||||
from airflow.contrib.hooks.salesforce_hook import SalesforceHook
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import configuration, AirflowException
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
import shutil
|
||||
import os
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
import json
|
||||
from requests.exceptions import MissingSchema
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.models import Connection
|
||||
from airflow.utils import db
|
||||
from airflow.contrib.hooks.slack_webhook_hook import SlackWebhookHook
|
||||
from tests.compat import mock
|
||||
|
||||
|
||||
class TestSlackWebhookHook(unittest.TestCase):
|
||||
|
@ -104,8 +104,9 @@ class TestSlackWebhookHook(unittest.TestCase):
|
|||
# Then
|
||||
self.assertEqual(self.expected_message, message)
|
||||
|
||||
@mock.patch('requests.Session')
|
||||
@mock.patch('requests.Request')
|
||||
def test_url_generated_by_http_conn_id(self, request_mock):
|
||||
def test_url_generated_by_http_conn_id(self, request_mock, session_mock):
|
||||
hook = SlackWebhookHook(http_conn_id='slack-webhook-url')
|
||||
try:
|
||||
hook.execute()
|
||||
|
@ -119,8 +120,9 @@ class TestSlackWebhookHook(unittest.TestCase):
|
|||
)
|
||||
request_mock.reset_mock()
|
||||
|
||||
@mock.patch('requests.Session')
|
||||
@mock.patch('requests.Request')
|
||||
def test_url_generated_by_endpoint(self, request_mock):
|
||||
def test_url_generated_by_endpoint(self, request_mock, session_mock):
|
||||
hook = SlackWebhookHook(webhook_token=self.expected_url)
|
||||
try:
|
||||
hook.execute()
|
||||
|
@ -134,8 +136,9 @@ class TestSlackWebhookHook(unittest.TestCase):
|
|||
)
|
||||
request_mock.reset_mock()
|
||||
|
||||
@mock.patch('requests.Session')
|
||||
@mock.patch('requests.Request')
|
||||
def test_url_generated_by_http_conn_id_and_endpoint(self, request_mock):
|
||||
def test_url_generated_by_http_conn_id_and_endpoint(self, request_mock, session_mock):
|
||||
hook = SlackWebhookHook(http_conn_id='slack-webhook-host',
|
||||
webhook_token='B000/XXX')
|
||||
try:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
import os
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
|
|
|
@ -22,7 +22,7 @@ import six
|
|||
import unittest
|
||||
from itertools import dropwhile
|
||||
|
||||
from mock import patch, call
|
||||
from unittest.mock import patch, call
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.models import Connection
|
||||
|
|
|
@ -23,7 +23,7 @@ import unittest
|
|||
from airflow import configuration, AirflowException
|
||||
from airflow.models import Connection
|
||||
from airflow.utils import db
|
||||
from mock import patch, call
|
||||
from unittest.mock import patch, call
|
||||
|
||||
from airflow.contrib.hooks.spark_submit_hook import SparkSubmitHook
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ from airflow.exceptions import AirflowException
|
|||
from airflow.models import Connection
|
||||
from airflow.utils import db
|
||||
|
||||
from mock import patch, call
|
||||
from unittest.mock import patch, call
|
||||
|
||||
from io import StringIO
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import AirflowException
|
||||
from airflow.contrib.hooks.winrm_hook import WinRMHook
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from airflow.hooks.zendesk_hook import ZendeskHook
|
||||
from zdesk import RateLimitError
|
||||
|
|
|
@ -22,7 +22,7 @@ import unittest
|
|||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.aws_sqs_publish_operator import SQSPublishOperator
|
||||
from airflow.utils import timezone
|
||||
from mock import MagicMock
|
||||
from unittest.mock import MagicMock
|
||||
from moto import mock_sqs
|
||||
from airflow.contrib.hooks.aws_sqs_hook import SQSHook
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
import mock
|
||||
from unittest import mock
|
||||
from builtins import str
|
||||
from airflow.contrib.operators.cassandra_to_gcs import \
|
||||
CassandraToGoogleCloudStorageOperator
|
||||
|
|
|
@ -39,8 +39,8 @@ from tests.compat import mock
|
|||
|
||||
from copy import deepcopy
|
||||
|
||||
from mock import MagicMock, Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock, Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
TASK_ID = 'test-dataproc-operator'
|
||||
CLUSTER_NAME = 'test-cluster-name'
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.dingding_operator import DingdingOperator
|
||||
|
@ -68,4 +68,4 @@ class TestDingdingOperator(unittest.TestCase):
|
|||
self._config['at_mobiles'],
|
||||
self._config['at_all']
|
||||
)
|
||||
mock_hook.return_value.send.assert_called_once()
|
||||
mock_hook.return_value.send.assert_called_once_with()
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import DAG, configuration
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
from datetime import timedelta
|
||||
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.emr_add_steps_operator import EmrAddStepsOperator
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
import unittest
|
||||
from datetime import timedelta
|
||||
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobFlowOperator
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.contrib.operators.emr_terminate_job_flow_operator import EmrTerminateJobFlowOperator
|
||||
|
|
|
@ -22,7 +22,7 @@ import json
|
|||
import unittest
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import pandas as pd
|
||||
|
||||
from airflow import configuration, DAG
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.contrib.operators.imap_attachment_to_s3_operator import ImapAttachmentToS3Operator
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.jira_operator import JiraOperator
|
||||
|
|
|
@ -21,7 +21,7 @@ import unittest
|
|||
|
||||
import httplib2
|
||||
from googleapiclient.errors import HttpError
|
||||
from mock import ANY, patch
|
||||
from unittest.mock import ANY, patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.operators.mlengine_operator import (MLEngineBatchPredictionOperator,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import configuration, AirflowException
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.contrib.operators.sns_publish_operator import SnsPublishOperator
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.contrib.operators.vertica_operator import VerticaOperator
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import DAG, configuration
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.contrib.operators.winrm_operator import WinRMOperator
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import DAG
|
||||
from airflow import configuration
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.contrib.sensors.celery_queue_sensor import CeleryQueueSensor
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
import datetime
|
||||
from dateutil.tz import tzlocal
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.contrib.sensors.emr_job_flow_sensor import EmrJobFlowSensor
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
from dateutil.tz import tzlocal
|
||||
|
||||
from airflow import configuration, AirflowException
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
|
||||
from ftplib import error_perm
|
||||
from mock import MagicMock
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from airflow.contrib.hooks.ftp_hook import FTPHook
|
||||
from airflow.contrib.sensors.ftp_sensor import FTPSensor
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch, Mock
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
from airflow import configuration
|
||||
from airflow.contrib.sensors.imap_attachment_sensor import ImapAttachmentSensor
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.contrib.sensors.jira_sensor import JiraTicketSensor
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
import unittest
|
||||
|
||||
from datetime import datetime
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.contrib.sensors.qubole_sensor import QuboleFileSensor, QubolePartitionSensor
|
||||
from airflow.exceptions import AirflowException
|
||||
|
|
|
@ -23,7 +23,7 @@ from airflow import DAG, configuration
|
|||
from airflow.contrib.sensors.redis_pub_sub_sensor import RedisPubSubSensor
|
||||
from airflow.utils import timezone
|
||||
from airflow.contrib.hooks.redis_hook import RedisHook
|
||||
from mock import patch, call, MagicMock
|
||||
from unittest.mock import patch, call, MagicMock
|
||||
|
||||
DEFAULT_DATE = timezone.datetime(2017, 1, 1)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
from paramiko import SFTP_NO_SUCH_FILE, SFTP_FAILURE
|
||||
from airflow.contrib.sensors.sftp_sensor import SFTPSensor
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import unittest
|
|||
from airflow import DAG, configuration
|
||||
from airflow.contrib.sensors.aws_sqs_sensor import SQSSensor
|
||||
from airflow.utils import timezone
|
||||
from mock import patch, MagicMock
|
||||
from unittest.mock import patch, MagicMock
|
||||
from airflow.exceptions import AirflowException
|
||||
from moto import mock_sqs
|
||||
from airflow.contrib.hooks.aws_sqs_hook import SQSHook
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.contrib.task_runner.cgroup_task_runner import CgroupTaskRunner
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
GCP_PROJECT_ID_HOOK_UNIT_TEST = 'example-project'
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ from airflow.contrib.utils import mlengine_operator_utils
|
|||
from airflow.exceptions import AirflowException
|
||||
from airflow.version import version
|
||||
|
||||
from mock import ANY
|
||||
from mock import patch
|
||||
from unittest.mock import ANY
|
||||
from unittest.mock import patch
|
||||
|
||||
DEFAULT_DATE = datetime.datetime(2017, 6, 6)
|
||||
TEST_VERSION = 'v{}'.format(version.replace('.', '-').replace('+', '-'))
|
||||
|
|
|
@ -21,7 +21,7 @@ import json
|
|||
import unittest
|
||||
|
||||
import doctest
|
||||
import mock
|
||||
from unittest import mock
|
||||
import multiprocessing
|
||||
import os
|
||||
import pickle # type: ignore
|
||||
|
|
|
@ -22,7 +22,7 @@ import unittest
|
|||
import contextlib
|
||||
from multiprocessing import Pool
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from celery import Celery
|
||||
from celery import states as celery_states
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.hooks.dbapi_hook import DbApiHook
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
import requests
|
||||
import requests_mock
|
||||
import unittest
|
||||
|
|
|
@ -26,7 +26,7 @@ import sys
|
|||
import unittest
|
||||
from collections import OrderedDict
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import pandas as pd
|
||||
from hmsclient import HMSClient
|
||||
|
||||
|
|
|
@ -76,8 +76,9 @@ class TestHttpHook(unittest.TestCase):
|
|||
self.assertEqual(resp.text, '{"status":{"status": 200}}')
|
||||
|
||||
@requests_mock.mock()
|
||||
@mock.patch('requests.Session')
|
||||
@mock.patch('requests.Request')
|
||||
def test_get_request_with_port(self, m, request_mock):
|
||||
def test_get_request_with_port(self, m, request_mock, session_mock):
|
||||
from requests.exceptions import MissingSchema
|
||||
|
||||
with mock.patch(
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
|
||||
import json
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
import MySQLdb.cursors
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.hooks.presto_hook import PrestoHook
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
|
||||
from hdfs import HdfsError
|
||||
from mock import patch, call
|
||||
from unittest.mock import patch, call
|
||||
|
||||
from airflow.hooks.webhdfs_hook import WebHDFSHook, AirflowWebHDFSHookException
|
||||
from airflow.models.connection import Connection
|
||||
|
|
|
@ -21,7 +21,7 @@ import unittest
|
|||
from collections import namedtuple
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
from parameterized import parameterized
|
||||
|
||||
from airflow.models import Connection, crypto
|
||||
|
|
|
@ -28,7 +28,7 @@ from tempfile import NamedTemporaryFile
|
|||
import jinja2
|
||||
import pendulum
|
||||
import six
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import models, settings, configuration
|
||||
from airflow.exceptions import AirflowException, AirflowDagCycleException
|
||||
|
|
|
@ -24,7 +24,7 @@ import textwrap
|
|||
import unittest
|
||||
from tempfile import mkdtemp, NamedTemporaryFile
|
||||
|
||||
from mock import patch, ANY
|
||||
from unittest.mock import patch, ANY
|
||||
|
||||
from airflow import models, configuration
|
||||
from airflow.models import DagModel, DagBag, TaskInstance as TI
|
||||
|
@ -128,7 +128,7 @@ class DagBagTest(unittest.TestCase):
|
|||
test the loading of a DAG from within a zip file that skips another file because
|
||||
it doesn't have "airflow" and "DAG"
|
||||
"""
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
with patch('airflow.models.DagBag.log') as log_mock:
|
||||
log_mock.info = Mock()
|
||||
test_zip_path = os.path.join(TEST_DAGS_FOLDER, "test_zip.zip")
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import settings
|
||||
from airflow.models import KubeResourceVersion, KubeWorkerIdentifier
|
||||
|
|
|
@ -21,7 +21,7 @@ import datetime
|
|||
import unittest
|
||||
|
||||
import pendulum
|
||||
from mock import patch, Mock
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
from airflow import settings
|
||||
from airflow.models import DAG, TaskInstance as TI
|
||||
|
|
|
@ -24,7 +24,7 @@ import urllib
|
|||
|
||||
import pendulum
|
||||
from freezegun import freeze_time
|
||||
from mock import patch, mock_open
|
||||
from unittest.mock import patch, mock_open
|
||||
from parameterized import parameterized
|
||||
|
||||
from airflow import models, settings, configuration
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import settings
|
||||
from airflow.models import crypto, Variable
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import configuration, DAG
|
||||
|
|
|
@ -21,7 +21,7 @@ import datetime
|
|||
import os
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import nose
|
||||
|
||||
from airflow import DAG, configuration, operators
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
from collections import OrderedDict
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import AirflowException
|
||||
from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch, PropertyMock
|
||||
from unittest.mock import patch, PropertyMock
|
||||
|
||||
from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
|
||||
from airflow.utils.operator_helpers import context_to_airflow_vars
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch, PropertyMock, Mock
|
||||
from unittest.mock import patch, PropertyMock, Mock
|
||||
|
||||
from airflow.operators.hive_to_samba_operator import Hive2SambaOperator
|
||||
from airflow.utils.operator_helpers import context_to_airflow_vars
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.operators.jdbc_operator import JdbcOperator
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ try:
|
|||
import pymssql
|
||||
except ImportError:
|
||||
pymssql = None
|
||||
from mock import patch, PropertyMock, Mock
|
||||
from unittest.mock import patch, PropertyMock, Mock
|
||||
|
||||
from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ from airflow.utils import timezone
|
|||
from collections import OrderedDict
|
||||
|
||||
import os
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
configuration.load_test_config()
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.operators.papermill_operator import PapermillOperator
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow.operators.presto_to_mysql import PrestoToMySqlTransfer
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from boto3.session import Session
|
||||
|
|
|
@ -27,7 +27,7 @@ import unittest
|
|||
from tempfile import mkdtemp
|
||||
|
||||
import boto3
|
||||
import mock
|
||||
from unittest import mock
|
||||
from moto import mock_s3
|
||||
|
||||
from airflow.exceptions import AirflowException
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from boto3.session import Session
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
import airflow
|
||||
from airflow.exceptions import AirflowException
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow import DAG, configuration, settings
|
||||
from airflow.exceptions import (AirflowSensorTimeout, AirflowException,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import unittest
|
||||
|
||||
import requests
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from airflow import DAG, configuration
|
||||
from airflow.exceptions import AirflowException, AirflowSensorTimeout
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
from parameterized import parameterized
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow.sensors.s3_prefix_sensor import S3PrefixSensor
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import mock
|
||||
from unittest import mock
|
||||
import unittest
|
||||
|
||||
from airflow import DAG
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import mock
|
||||
from unittest import mock
|
||||
import os
|
||||
import psutil
|
||||
import time
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
|
||||
from airflow.stats import SafeStatsdLogger
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
|
||||
class TestStats(unittest.TestCase):
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
from contextlib import ContextDecorator
|
||||
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow import conf
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow.models import TaskInstance
|
||||
from airflow.ti_deps.deps.dag_ti_slots_available_dep import DagTISlotsAvailableDep
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# under the License.
|
||||
|
||||
import unittest
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow.models import TaskInstance
|
||||
from airflow.ti_deps.deps.dag_unpaused_dep import DagUnpausedDep
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
from airflow.utils.state import State
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from airflow.models import DAG, DagRun
|
||||
from airflow.ti_deps.deps.dagrun_exists_dep import DagrunRunningDep
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import unittest
|
||||
from datetime import timedelta
|
||||
from freezegun import freeze_time
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow.models import TaskInstance
|
||||
from airflow.ti_deps.deps.not_in_retry_period_dep import NotInRetryPeriodDep
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from airflow.ti_deps.deps.not_running_dep import NotRunningDep
|
||||
from airflow.utils.state import State
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче