Skip to content

Commit

Permalink
tests: use unittest.mock with py34+
Browse files Browse the repository at this point in the history
Fixes #3965.
  • Loading branch information
blueyed committed Sep 11, 2018
1 parent 2c90b3d commit e9ab074
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions testing/code/test_code.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# coding: utf-8
from __future__ import absolute_import, division, print_function

import sys

import _pytest._code
import pytest
import mock
from test_excinfo import TWMock
from six import text_type

from test_excinfo import TWMock

try:
import mock
except ImportError:
import unittest.mock as mock


def test_ne():
code1 = _pytest._code.Code(compile('foo = "bar"', "", "exec"))
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ setenv =
deps =
hypothesis>=3.56
nose
mock
py27: mock
requests
{env:_PYTEST_TOX_EXTRA_DEP:}

[testenv:py27-subprocess]
changedir = .
deps =
pytest-xdist>=1.13
mock
py27: mock
nose
passenv = USER USERNAME TRAVIS
commands =
Expand All @@ -54,7 +54,7 @@ commands = pre-commit run --all-files --show-diff-on-failure
[testenv:py27-xdist]
deps =
pytest-xdist>=1.13
mock
py27: mock
nose
hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:}
Expand Down Expand Up @@ -87,7 +87,7 @@ commands = {[testenv:py27-pexpect]commands}
deps =
pytest-xdist>=1.13
hypothesis>=3.56
mock
py27: mock
{env:_PYTEST_TOX_EXTRA_DEP:}
distribute = true
changedir=testing
Expand Down

0 comments on commit e9ab074

Please sign in to comment.