Skip to content

Commit

Permalink
Merge pull request #233 from nsano-rururu/mock_to_unittest_mock
Browse files Browse the repository at this point in the history
change mock to build in unittest.mock
  • Loading branch information
jertel authored Jun 4, 2021
2 parents bdb8360 + 7af64f6 commit 7896cfa
Show file tree
Hide file tree
Showing 35 changed files with 33 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Improve Gitter alerter by explicitly specifying arg names - [#230](https://github.com/jertel/elastalert2/pull/230) - @nsano-rururu
- Add more alerter test code coverage - [#231](https://github.com/jertel/elastalert2/pull/231) - @nsano-rururu
- Upgrade pytest-cov from 2.12.0 to 2.12.1 - [#232](https://github.com/jertel/elastalert2/pull/232) - @nsano-rururu
- Migrate away from external test mock dependency - [#233](https://github.com/jertel/elastalert2/pull/233) - @nsano-rururu

# 2.1.0

Expand Down
2 changes: 1 addition & 1 deletion elastalert/test_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import string
import sys

import mock
from unittest import mock

from elastalert.config import load_conf
from elastalert.elastalert import ElastAlerter
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ exotel>=0.1.3
Jinja2==2.11.3
jira>=2.0.0
jsonschema>=3.0.2
mock>=2.0.0
prison>=0.1.2
prometheus_client>=0.10.1
py-zabbix>=1.1.3
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
'jira>=2.0.0',
'Jinja2==2.11.3',
'jsonschema>=3.0.2',
'mock>=2.0.0',
'prison>=0.1.2',
'prometheus_client>=0.10.1',
'py-zabbix>=1.1.3',
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/alerta_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/chatwork_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock
import pytest
from requests import RequestException
from requests.auth import HTTPProxyAuth
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/command_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import subprocess

import mock
from unittest import mock
import pytest

from elastalert.alerters.command import CommandAlerter
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/datadog_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/dingtalk_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException
from requests.auth import HTTPProxyAuth
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/discord_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException
from requests.auth import HTTPProxyAuth
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/email_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import base64

import mock
from unittest import mock
import pytest

from elastalert.alerters.email import EmailAlerter
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/gitter_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/googlechat_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/httppost_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/jira_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

import mock
from unittest import mock
import pytest
from jira import JIRAError

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/line_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/mattermost_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/opsgenie_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/pagerduty_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/pagertree_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
import uuid

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/rocketchat_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/servicenow_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/slack_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/teams_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/telegram_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException
from requests.auth import HTTPProxyAuth
Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/thehive_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

Expand Down
2 changes: 1 addition & 1 deletion tests/alerters/victorops_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

import mock
from unittest import mock
import pytest
from requests import RequestException

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

from elastalert.alerters.zabbix import ZabbixAlerter
from elastalert.loaders import FileRulesLoader
Expand Down
2 changes: 1 addition & 1 deletion tests/alerts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import datetime
import json

import mock
from unittest import mock

from elastalert.alerts import Alerter
from elastalert.alerts import BasicMatchString
Expand Down
2 changes: 1 addition & 1 deletion tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import threading

import elasticsearch
import mock
from unittest import mock
import pytest
from elasticsearch.exceptions import ConnectionError
from elasticsearch.exceptions import ElasticsearchException
Expand Down
2 changes: 1 addition & 1 deletion tests/config_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import os
import mock
from unittest import mock
import datetime

from elastalert.config import load_conf
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import os

import mock
from unittest import mock
import pytest

import elastalert.elastalert
Expand Down
2 changes: 1 addition & 1 deletion tests/loaders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
import os

import mock
from unittest import mock
import pytest

import elastalert.alerts
Expand Down
2 changes: 1 addition & 1 deletion tests/rules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import copy
import datetime

import mock
from unittest import mock
import pytest

from elastalert.ruletypes import AnyRule
Expand Down
2 changes: 1 addition & 1 deletion tests/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime
from datetime import timedelta

import mock
from unittest import mock
import pytest
from dateutil.parser import parse as dt

Expand Down

0 comments on commit 7896cfa

Please sign in to comment.