diff options
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | tests/test_bcrypt.py | 11 | ||||
-rw-r--r-- | tox.ini | 1 |
3 files changed, 3 insertions, 11 deletions
@@ -225,12 +225,10 @@ setup( extras_require={ "tests": [ "pytest", - "mock", ], }, tests_require=[ "pytest", - "mock", ], packages=[ diff --git a/tests/test_bcrypt.py b/tests/test_bcrypt.py index bb32299..3dc1ca1 100644 --- a/tests/test_bcrypt.py +++ b/tests/test_bcrypt.py @@ -1,7 +1,5 @@ import os -import mock - import pytest import six @@ -15,8 +13,7 @@ def test_raise_implicit_compile(): def test_gensalt_basic(monkeypatch): - urandom = mock.Mock(return_value=b"0000000000000000") - monkeypatch.setattr(os, "urandom", urandom) + monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000") assert bcrypt.gensalt() == b"$2a$12$KB.uKB.uKB.uKB.uKB.uK." @@ -44,15 +41,13 @@ def test_gensalt_basic(monkeypatch): (24, b"$2a$24$KB.uKB.uKB.uKB.uKB.uK."), ]) def test_gensalt_rounds_valid(rounds, expected, monkeypatch): - urandom = mock.Mock(return_value=b"0000000000000000") - monkeypatch.setattr(os, "urandom", urandom) + monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000") assert bcrypt.gensalt(rounds) == expected @pytest.mark.parametrize(("rounds",), [[x] for x in range(1, 4)]) def test_gensalt_rounds_invalid(rounds, monkeypatch): - urandom = mock.Mock(return_value=b"0000000000000000") - monkeypatch.setattr(os, "urandom", urandom) + monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000") with pytest.raises(ValueError): bcrypt.gensalt(rounds) @@ -5,7 +5,6 @@ envlist = py26,py27,pypy,py32,py33,py34,pep8,py3pep8 # If you add a new dep here you probably need to add it in setup.py as well deps = coverage - mock pytest commands = coverage run -m pytest --strict {posargs} |