Skip to content

Commit

Permalink
Avoid mock library backport on Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jul 13, 2019
2 parents 60cf36a + d123d92 commit ea4c995
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ their individual contributions.
* `Lisa Goeller <https://www.github.com/lgoeller>`_
* `Louis Taylor <https://github.com/kragniz>`_
* `Luke Barone-Adesi <https://github.com/baluke>`_
* `Lundy Bernard <https://github.com/lundybernard>`_
* `Marco Sirabella <https://www.github.com/mjsir911>`_
* `marekventur <https://www.github.com/marekventur>`_
* `Marius Gedminas <https://www.github.com/mgedmin>`_ (marius@gedmin.as)
Expand Down
6 changes: 5 additions & 1 deletion hypothesis-python/tests/cover/test_reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from functools import partial

import pytest
from mock import MagicMock, Mock, NonCallableMagicMock, NonCallableMock

from hypothesis.internal.compat import PY2, PY3, FullArgSpec, getfullargspec
from hypothesis.internal.reflection import (
Expand All @@ -42,6 +41,11 @@
)
from tests.common.utils import raises

try:
from unittest.mock import MagicMock, Mock, NonCallableMagicMock, NonCallableMock
except ImportError:
from mock import MagicMock, Mock, NonCallableMagicMock, NonCallableMock


def do_conversion_test(f, args, kwargs):
result = f(*args, **kwargs)
Expand Down
6 changes: 5 additions & 1 deletion hypothesis-python/tests/cover/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

from hypothesis import Verbosity, assume, given, seed, settings, strategies as st

try:
from unittest.mock import Mock
except ImportError:
from mock import Mock


def strat():
return st.builds(dict, one=strat_one())
Expand Down Expand Up @@ -66,7 +71,6 @@ def test_mock_injection():
(covers https://github.com/HypothesisWorks/hypothesis-
python/issues/491)
"""
from mock import Mock

class Bar:
pass
Expand Down
1 change: 1 addition & 0 deletions hypothesis-python/tests/cover/test_statistical_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test(i):
def test_flaky_exit():
first = [True]

@settings(derandomize=True)
@given(st.integers())
def test(i):
if i > 1001:
Expand Down
6 changes: 5 additions & 1 deletion hypothesis-python/tests/pytest/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
from __future__ import absolute_import, division, print_function

import pytest
from mock import Mock, create_autospec

from hypothesis import example, given
from hypothesis.strategies import integers
from tests.common.utils import fails

try:
from unittest.mock import Mock, create_autospec
except ImportError:
from mock import Mock, create_autospec


@pytest.fixture
def infinity():
Expand Down
1 change: 0 additions & 1 deletion requirements/test.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
attrs
mock
pytest
pytest-xdist
3 changes: 1 addition & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ atomicwrites==1.3.0 # via pytest
attrs==19.1.0
execnet==1.6.0 # via pytest-xdist
importlib-metadata==0.18 # via pluggy, pytest
mock==3.0.5
more-itertools==5.0.0 # via pytest
packaging==19.0 # via pytest
pluggy==0.12.0 # via pytest
Expand All @@ -18,6 +17,6 @@ pyparsing==2.4.0 # via packaging
pytest-forked==1.0.2 # via pytest-xdist
pytest-xdist==1.29.0
pytest==5.0.0
six==1.12.0 # via mock, more-itertools, packaging, pytest-xdist
six==1.12.0 # via more-itertools, packaging, pytest-xdist
wcwidth==0.1.7 # via pytest
zipp==0.5.1 # via importlib-metadata
1 change: 0 additions & 1 deletion requirements/tools.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ flake8-docstrings
ipython
isort
lark-parser
mock
mypy
numpy
pip-tools
Expand Down
3 changes: 1 addition & 2 deletions requirements/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ lark-parser==0.7.1
lazy-object-proxy==1.4.1 # via astroid
markupsafe==1.1.1 # via jinja2
mccabe==0.6.1 # via flake8, pylint
mock==3.0.5
more-itertools==7.1.0 # via pytest
mypy-extensions==0.4.1 # via mypy
mypy==0.711
Expand Down Expand Up @@ -81,7 +80,7 @@ requests-toolbelt==0.9.1 # via twine
requests==2.22.0
restructuredtext-lint==1.3.0
safety==1.8.5 # via pyupio
six==1.12.0 # via astroid, bandit, bleach, dparse, mock, packaging, pip-tools, prompt-toolkit, pydocstyle, python-dateutil, python-gitlab, pyupio, readme-renderer, stevedore, tox, traitlets
six==1.12.0 # via astroid, bandit, bleach, dparse, packaging, pip-tools, prompt-toolkit, pydocstyle, python-dateutil, python-gitlab, pyupio, readme-renderer, stevedore, tox, traitlets
smmap2==2.0.5 # via gitdb2
snowballstemmer==1.9.0 # via pydocstyle, sphinx
sphinx-rtd-theme==0.4.3
Expand Down

0 comments on commit ea4c995

Please sign in to comment.