Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
language: python
python:
- 2.6
- 2.7
- 3.4
- 3.5
- pypy

install:
- pip install coveralls --use-wheel
- pip install tox coveralls

script:
- python setup.py develop
- coverage run --source=pytest_mock.py runtests.py
- tox

after_success:
- coveralls
17 changes: 15 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
0.10.1
------

* Fix regression in frozen tests due to ``distutils`` import dependency.
Thanks `@The-Compiler`_ for the report (`#29`_).

* Fix regression when using ``pytest-mock`` with ``pytest-2.7.X``.
Thanks `@akscram`_ for the report (`#28`_).

.. _@akscram: https://github.com/Chronial
.. _#28: https://github.com/pytest-dev/pytest-mock/issues/28
.. _#29: https://github.com/pytest-dev/pytest-mock/issues/29

0.10
----

Expand All @@ -6,8 +19,8 @@
Thanks to `@Chronial`_ for idea and PR (`#26`_, `#27`_)!

.. _@Chronial: https://github.com/Chronial
.. _#26: https://github.com/pytest-dev/pytest-qt/issues/26
.. _#27: https://github.com/pytest-dev/pytest-qt/issues/27
.. _#26: https://github.com/pytest-dev/pytest-mock/issues/26
.. _#27: https://github.com/pytest-dev/pytest-mock/issues/27

0.9.0
-----
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
install:
- C:\Python34\python -m pip install tox
- C:\Python35\python -m pip install tox

build: false # Not a C# project

test_script:
- C:\Python34\scripts\tox -e py27,py34,py35
- C:\Python35\scripts\tox
17 changes: 13 additions & 4 deletions pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import sys

import pytest
from distutils.util import strtobool

if sys.version_info >= (3, 3): # pragma: no cover
import unittest.mock as mock_module
else:
import mock as mock_module

version = '0.10.0'
version = '0.10.1'


class MockFixture(object):
"""
Expand Down Expand Up @@ -207,7 +207,13 @@ def wrap_assert_methods(config):
mock_module.NonCallableMock, method, wrapper)
patcher.start()
_mock_module_patches.append(patcher)
config.add_cleanup(unwrap_assert_methods)

if hasattr(config, 'add_cleanup'):
add_cleanup = config.add_cleanup
else:
# pytest 2.7 compatibility
add_cleanup = config._cleanup.append
add_cleanup(unwrap_assert_methods)


def unwrap_assert_methods():
Expand All @@ -227,7 +233,10 @@ def pytest_addoption(parser):
def parse_ini_boolean(value):
if value in (True, False):
return value
return bool(strtobool(value))
try:
return {'true': True, 'false': False}[value.lower()]
except KeyError:
raise ValueError('unknown string for bool: %r' % value)


def pytest_configure(config):
Expand Down
3 changes: 0 additions & 3 deletions runtests.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
py_modules=['pytest_mock'],
platforms='any',
install_requires=[
'pytest>=2.4',
'pytest>=2.7',
],
extras_require={
':python_version=="2.6" or python_version=="2.7"': ['mock'],
Expand Down
7 changes: 5 additions & 2 deletions test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,11 @@ def test_foo(mocker):
[pytest]
mock_traceback_monkeypatch = false
""")

result = testdir.runpytest_subprocess()
if hasattr(testdir, 'runpytest_subprocess'):
result = testdir.runpytest_subprocess()
else:
# pytest 2.7.X
result = testdir.runpytest()
assert result.ret == 0


Expand Down
9 changes: 7 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[tox]
# note that tox expects interpreters to be found at C:\PythonXY,
# with XY being python version ("27" or "34") for instance
envlist = py26, py27, py34, py35
envlist = py{26,27,34,35}-pytest{27,28}

[testenv]
commands = py.test test_pytest_mock.py
passenv = USER USERNAME
deps =
coverage
pytest27: pytest==2.7.3
pytest28: pytest==2.8.7
commands = coverage run --append --source=pytest_mock.py -m pytest test_pytest_mock.py