nuke mock dependency

This is already included in Python 3.3+ as unittest.mock
This commit is contained in:
Thomas Kriechbaumer 2017-01-22 13:44:53 +01:00
parent 0022c810e5
commit 127c69c3ac
22 changed files with 30 additions and 28 deletions

View File

@ -100,7 +100,6 @@ setup(
"mypy-lang>=0.4.6, <0.5", "mypy-lang>=0.4.6, <0.5",
"rstcheck>=2.2, <4.0", "rstcheck>=2.2, <4.0",
"tox>=2.3, <3", "tox>=2.3, <3",
"mock>=2.0, <2.1",
"pytest>=3, <3.1", "pytest>=3, <3.1",
"pytest-cov>=2.2.1, <3", "pytest-cov>=2.2.1, <3",
"pytest-timeout>=1.0.0, <2", "pytest-timeout>=1.0.0, <2",

View File

@ -1,5 +1,5 @@
import os import os
import mock from unittest import mock
from mitmproxy.test import tflow from mitmproxy.test import tflow
from mitmproxy.test import tutils from mitmproxy.test import tutils
@ -33,7 +33,7 @@ class TestClientPlayback:
with mock.patch(RP) as rp: with mock.patch(RP) as rp:
assert not cp.current_thread assert not cp.current_thread
cp.tick() cp.tick()
rp.assert_called() assert rp.called
assert cp.current_thread assert cp.current_thread
cp.keepserving = False cp.keepserving = False
@ -41,7 +41,7 @@ class TestClientPlayback:
cp.current_thread = None cp.current_thread = None
with mock.patch("mitmproxy.master.Master.shutdown") as sd: with mock.patch("mitmproxy.master.Master.shutdown") as sd:
cp.tick() cp.tick()
sd.assert_called() assert sd.called
cp.current_thread = MockThread() cp.current_thread = MockThread()
with mock.patch("mitmproxy.master.Master.shutdown") as sd: with mock.patch("mitmproxy.master.Master.shutdown") as sd:

View File

@ -1,4 +1,7 @@
import io import io
import shutil
from unittest import mock
from mitmproxy.test import tflow from mitmproxy.test import tflow
from mitmproxy.test import taddons from mitmproxy.test import taddons
from mitmproxy.test import tutils from mitmproxy.test import tutils
@ -7,8 +10,6 @@ from mitmproxy.addons import dumper
from mitmproxy import exceptions from mitmproxy import exceptions
from mitmproxy.tools import dump from mitmproxy.tools import dump
from mitmproxy import http from mitmproxy import http
import shutil
import mock
def test_configure(): def test_configure():

View File

@ -1,4 +1,4 @@
import mock from unittest import mock
from mitmproxy import log from mitmproxy import log
from mitmproxy.addons import eventstore from mitmproxy.addons import eventstore

View File

@ -3,7 +3,7 @@ from os.path import normpath
from mitmproxy.tools.console import pathedit from mitmproxy.tools.console import pathedit
from mitmproxy.test import tutils from mitmproxy.test import tutils
from mock import patch from unittest.mock import patch
class TestPathCompleter: class TestPathCompleter:

View File

@ -1,4 +1,4 @@
import mock from unittest import mock
from mitmproxy import contentviews from mitmproxy import contentviews
from mitmproxy.exceptions import ContentViewException from mitmproxy.exceptions import ContentViewException

View File

@ -1,6 +1,7 @@
import os import os
import sys import sys
import mock from unittest import mock
if os.name == "nt": if os.name == "nt":
m = mock.Mock() m = mock.Mock()
m.__version__ = "1.1.1" m.__version__ = "1.1.1"

View File

@ -1,5 +1,5 @@
from io import BytesIO from io import BytesIO
from mock import Mock from unittest.mock import Mock
import pytest import pytest
from mitmproxy import exceptions from mitmproxy import exceptions

View File

@ -1,9 +1,9 @@
import time import time
from unittest import mock
from mitmproxy.net.http import cookies from mitmproxy.net.http import cookies
from mitmproxy.test.tutils import raises from mitmproxy.test.tutils import raises
import mock
cookie_pairs = [ cookie_pairs = [
[ [

View File

@ -1,4 +1,4 @@
import mock from unittest import mock
import pytest import pytest
from mitmproxy.net.http import encoding from mitmproxy.net.http import encoding

View File

@ -5,8 +5,8 @@ import socket
import random import random
import os import os
import threading import threading
import mock
import pytest import pytest
from unittest import mock
from OpenSSL import SSL from OpenSSL import SSL
from mitmproxy import certs from mitmproxy import certs

View File

@ -1,6 +1,6 @@
from threading import Thread, Event from threading import Thread, Event
from mock import Mock from unittest.mock import Mock
from mitmproxy import controller from mitmproxy import controller
import queue import queue

View File

@ -1,6 +1,7 @@
import io import io
from unittest.mock import patch
from mitmproxy.test import tflow from mitmproxy.test import tflow
from mock import patch
from mitmproxy import flowfilter from mitmproxy import flowfilter
from . import tutils as ttutils from . import tutils as ttutils

View File

@ -1,6 +1,6 @@
from mitmproxy.test import tflow from mitmproxy.test import tflow
import os import os
import mock from unittest import mock
import argparse import argparse
from OpenSSL import SSL from OpenSSL import SSL

View File

@ -2,7 +2,7 @@ import os
import socket import socket
import time import time
import mock from unittest import mock
from mitmproxy.test import tutils from mitmproxy.test import tutils
from mitmproxy import controller from mitmproxy import controller

View File

@ -1,15 +1,16 @@
import json as _json import json as _json
from unittest import mock
import mock
import tornado.testing import tornado.testing
from tornado import httpclient
from tornado import websocket
from mitmproxy import exceptions from mitmproxy import exceptions
from mitmproxy import proxy from mitmproxy import proxy
from mitmproxy import options from mitmproxy import options
from mitmproxy.test import tflow from mitmproxy.test import tflow
from mitmproxy.tools.web import app from mitmproxy.tools.web import app
from mitmproxy.tools.web import master as webmaster from mitmproxy.tools.web import master as webmaster
from tornado import httpclient
from tornado import websocket
def json(resp: httpclient.HTTPResponse): def json(resp: httpclient.HTTPResponse):

View File

@ -1,7 +1,6 @@
import io import io
import typing import typing
from unittest import mock
import mock
import pytest import pytest
from mitmproxy.utils import typecheck from mitmproxy.utils import typecheck

View File

@ -1,5 +1,5 @@
import io import io
import mock from unittest import mock
from mitmproxy.utils import version_check from mitmproxy.utils import version_check

View File

@ -1,5 +1,5 @@
import io import io
from mock import Mock from unittest.mock import Mock
import pytest import pytest
from mitmproxy.net import http from mitmproxy.net import http

View File

@ -1,5 +1,5 @@
import io import io
import mock from unittest import mock
from pathod import pathoc_cmdline as cmdline from pathod import pathoc_cmdline as cmdline

View File

@ -1,4 +1,4 @@
import mock from unittest import mock
from pathod import pathod_cmdline as cmdline from pathod import pathod_cmdline as cmdline

View File

@ -1,4 +1,4 @@
import mock from unittest import mock
import codecs import codecs
import hyperframe import hyperframe