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