1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
Forwarded: no, versions 3.x need to be packaged
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -7,10 +7,7 @@
pytest-relaxed>=1.0.1,<1.1
pytest==3.2.5
# pytest-cov for coverage
-pytest-cov==2.5.1
-six==1.10.0
-# Mock for test mocking
-mock==2.0.0
+pytest-cov==2.5.1 six==1.10.0
# Linting!
flake8==3.6.0
# Coverage!
--- a/fabric/testing/base.py
+++ b/fabric/testing/base.py
@@ -20,7 +20,7 @@
import os
try:
- from mock import Mock, PropertyMock, call, patch, ANY
+ from unittest.mock import Mock, PropertyMock, call, patch, ANY
except ImportError:
import warnings
--- a/fabric/testing/fixtures.py
+++ b/fabric/testing/fixtures.py
@@ -17,7 +17,7 @@
try:
from pytest import fixture
- from mock import patch, Mock
+ from unittest.mock import patch, Mock
except ImportError:
import warnings
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,7 @@
open("README.rst").read()
)
-testing_deps = ["mock>=2.0.0,<3.0"]
+testing_deps = []
pytest_deps = ["pytest>=3.2.5,<4.0"]
setuptools.setup(
--- a/sites/docs/getting-started.rst
+++ b/sites/docs/getting-started.rst
@@ -191,8 +191,7 @@
.. testsetup:: sudo
- from __future__ import print_function
- from mock import patch
+ from unittest.mock import patch
gp_patcher = patch('getpass.getpass', side_effect=lambda x: print(x))
gp_patcher.start()
mock = MockRemote()
--- a/tests/config.py
+++ b/tests/config.py
@@ -7,7 +7,7 @@
from fabric import Config
from fabric.util import get_local_user
-from mock import patch, call
+from unittest.mock import patch, call
from _util import support, faux_v1_env
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -5,7 +5,7 @@
from pytest import fixture
-from mock import patch
+from unittest.mock import patch
# TODO: does this want to end up in the public fixtures module too?
--- a/tests/connection.py
+++ b/tests/connection.py
@@ -1,15 +1,11 @@
from itertools import chain, repeat
-try:
- from invoke.vendor.six import b
-except ImportError:
- from six import b
import errno
from os.path import join
import socket
import time
-from mock import patch, Mock, call, ANY
+from unittest.mock import patch, Mock, call, ANY
from paramiko.client import SSHClient, AutoAddPolicy
from paramiko import SSHConfig
import pytest # for mark
@@ -1079,7 +1075,7 @@
listener_sock = Mock(name="listener_sock")
if listener_exception:
listener_sock.bind.side_effect = listener_exception
- data = b("Some data")
+ data = b"Some data"
tunnel_sock = Mock(name="tunnel_sock", recv=lambda n: data)
local_addr = Mock()
transport = client.get_transport.return_value
--- a/tests/executor.py
+++ b/tests/executor.py
@@ -4,7 +4,7 @@
from fabric.executor import ConnectionCall
from fabric.exceptions import NothingToDo
-from mock import Mock
+from unittest.mock import Mock
from pytest import skip, raises # noqa
--- a/tests/group.py
+++ b/tests/group.py
@@ -1,4 +1,4 @@
-from mock import Mock, patch, call
+from unittest.mock import Mock, patch, call
from pytest import mark, raises
from fabric import Connection, Group, SerialGroup, ThreadingGroup, GroupResult
--- a/tests/main.py
+++ b/tests/main.py
@@ -8,7 +8,7 @@
from invoke import run
from invoke.util import cd
-from mock import patch
+from unittest.mock import patch
import pytest # because WHY would you expose @skip normally? -_-
from pytest_relaxed import raises
--- a/tests/runners.py
+++ b/tests/runners.py
@@ -1,9 +1,6 @@
-try:
- from invoke.vendor.six import StringIO
-except ImportError:
- from six import StringIO
+from io import StringIO
-from mock import Mock
+from unittest.mock import Mock
from pytest import skip # noqa
from invoke import pty_size, Result
--- a/tests/task.py
+++ b/tests/task.py
@@ -1,6 +1,6 @@
# NOTE: named task.py, not tasks.py, to avoid some occasional pytest weirdness
-from mock import Mock
+from unittest.mock import Mock
from pytest import skip # noqa
import fabric
--- a/tests/transfer.py
+++ b/tests/transfer.py
@@ -1,9 +1,6 @@
-try:
- from invoke.vendor.six import StringIO
-except ImportError:
- from six import StringIO
+from io import StringIO
-from mock import Mock, call, patch
+from unittest.mock import Mock, call, patch
from pytest_relaxed import raises
from pytest import skip # noqa
from paramiko import SFTPAttributes
--- a/tests/util.py
+++ b/tests/util.py
@@ -2,7 +2,7 @@
Tests testing the fabric.util module, not utils for the tests!
"""
-from mock import patch
+from unittest.mock import patch
from fabric.util import get_local_user
--- a/fabric/connection.py
+++ b/fabric/connection.py
@@ -1,14 +1,8 @@
from contextlib import contextmanager
from threading import Event
-try:
- from invoke.vendor.six import StringIO
- from invoke.vendor.decorator import decorator
- from invoke.vendor.six import string_types
-except ImportError:
- from six import StringIO
- from decorator import decorator
- from six import string_types
+from io import StringIO
+from decorator import decorator
import socket
from invoke import Context
@@ -543,7 +537,7 @@
if self.gateway:
# Displaying type because gw params would probs be too verbose
val = "proxyjump"
- if isinstance(self.gateway, string_types):
+ if isinstance(self.gateway, str):
val = "proxycommand"
bits.append(("gw", val))
return "<Connection {}>".format(
@@ -648,7 +642,7 @@
.. versionadded:: 2.0
"""
# ProxyCommand is faster to set up, so do it first.
- if isinstance(self.gateway, string_types):
+ if isinstance(self.gateway, str):
# Leverage a dummy SSHConfig to ensure %h/%p/etc are parsed.
# TODO: use real SSH config once loading one properly is
# implemented.
--- a/fabric/group.py
+++ b/fabric/group.py
@@ -1,7 +1,4 @@
-try:
- from invoke.vendor.six.moves.queue import Queue
-except ImportError:
- from six.moves.queue import Queue
+from queue import Queue
from invoke.util import ExceptionHandlingThread
--- a/integration/concurrency.py
+++ b/integration/concurrency.py
@@ -1,7 +1,7 @@
import codecs
-from invoke.vendor.six.moves.queue import Queue
-from invoke.vendor.six.moves import zip_longest
+from queue import Queue
+from itertools import zip_longest
from invoke.util import ExceptionHandlingThread
from pytest import skip
|