use unittest2 on py26 to fix tests
This commit is contained in:
parent
1e2a9b2a44
commit
5bf7b534f2
3 changed files with 20 additions and 10 deletions
13
.travis.yml
13
.travis.yml
|
@ -1,11 +1,14 @@
|
|||
language: python
|
||||
python:
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
- "3.3"
|
||||
- "3.4"
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
- "3.3"
|
||||
- "3.4"
|
||||
# command to install dependencies
|
||||
install: "pip install -r dev-requirements.txt"
|
||||
install:
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then travis_retry pip install --use-mirrors unittest2; fi
|
||||
- travis_retry pip install --use-mirrors -r dev-requirements.txt
|
||||
# command to run tests
|
||||
script: nosetests
|
||||
# use new travis-ci container-based infrastructure
|
||||
sudo: false
|
||||
|
|
|
@ -2,13 +2,18 @@
|
|||
|
||||
|
||||
import logging
|
||||
import unittest
|
||||
from wakatime.packages.requests.models import Response
|
||||
|
||||
try:
|
||||
from mock import patch
|
||||
except:
|
||||
except ImportError:
|
||||
from unittest.mock import patch
|
||||
try:
|
||||
# Python 2.6
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
# Python >= 2.7
|
||||
import unittest
|
||||
|
||||
from wakatime.base import main
|
||||
|
||||
|
@ -21,8 +26,8 @@ class BaseTestCase(unittest.TestCase):
|
|||
logging.disable(logging.CRITICAL)
|
||||
|
||||
def test_help_contents(self, mock_requests):
|
||||
args = ['', '--help']
|
||||
with self.assertRaises(SystemExit):
|
||||
args = ['', '--help']
|
||||
retval = main(args)
|
||||
self.assertEquals(retval, 0)
|
||||
|
||||
|
|
6
tox.ini
6
tox.ini
|
@ -1,5 +1,7 @@
|
|||
[tox]
|
||||
envlist = py26, py27, py33, py34
|
||||
envlist = py26
|
||||
[testenv]
|
||||
deps = -rdev-requirements.txt
|
||||
deps =
|
||||
-rdev-requirements.txt
|
||||
py26: unittest2
|
||||
commands = nosetests
|
||||
|
|
Loading…
Reference in a new issue