From 966380a2f763845a453e81296c017ed45c6bb342 Mon Sep 17 00:00:00 2001 From: gryf Date: Thu, 24 Nov 2016 08:30:10 +0100 Subject: [PATCH] Fix for python2.7 environment Python envs used till now python3 for testing, now version of python depends on the environment - for py2* python 2.7 will be used, and for py3* appropriate python3 version will be used. Also, added mock module for python2 envs. --- tests/test_client.py | 5 ++++- tox.ini | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 7e8bdba..c61fa75 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,5 +1,8 @@ from unittest import TestCase -from unittest.mock import MagicMock +try: + from unittest.mock import MagicMock +except ImportError: + from mock import MagicMock from slack_backup import client from slack_backup import objects as o diff --git a/tox.ini b/tox.ini index d03ba12..06fb11e 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,19 @@ envlist = py27,py34,{py27,py34}-flake8 usedevelop = True [testenv] -basepython = python3.4 usedevelop=True setenv = COVERAGE_FILE = .coverage commands = py.test --cov=slack_backup --cov-report=term-missing deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:py27] +usedevelop={[testenv]usedevelop} +setenv = {[testenv]setenv} +commands = {[testenv]commands} +deps = {[testenv]deps} + mock + [testenv:py27-flake8] basepython = python2.7 deps = flake8