Skip to content

Commit

Permalink
Fixed packaging and using tox for testing
Browse files Browse the repository at this point in the history
Using builtin mock in Python >= 3.3
  • Loading branch information
nicoddemus committed Jul 17, 2014
1 parent 811db49 commit 2a1be6c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.md
include LICENSE
9 changes: 8 additions & 1 deletion pytest_mock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import sys

import pytest
import mock as mock_module


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


class MockFixture(object):
Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import sys

from setuptools import setup


dependencies = ['pytest>=2.4']
if sys.version_info < (3, 3):
dependencies.append('mock')

setup(
name='pytest-mock',
version='0.1.0',
entry_points={
'pytest11': ['pytest-mock = pytest_mock'],
},
modules=['pytest_mock'],
install_requires=['pytest>=2.3.4', 'mock'],
py_modules=['pytest_mock'],
platforms='any',
install_requires=dependencies,
url='https://github.com/nicoddemus/pytest-mock/',
license='LGPL',
author='Bruno Oliveira',
Expand Down
5 changes: 3 additions & 2 deletions test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ def mock_using_patch(mock):


def mock_using_patch_multiple(mock):
from mock import DEFAULT
from pytest_mock import mock_module

r = mock.patch.multiple('os', remove=DEFAULT, listdir=DEFAULT)
r = mock.patch.multiple('os', remove=mock_module.DEFAULT,
listdir=mock_module.DEFAULT)
return r['remove'], r['listdir']


Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[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, py32, py33, py34

[testenv]
commands = py.test test_pytest_mock.py

0 comments on commit 2a1be6c

Please sign in to comment.