diff --git a/.travis.yml b/.travis.yml index 34201cf..bd365c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ --- language: python python: + - 2.6 - 2.7 - 3.3 - 3.4 @@ -9,9 +10,10 @@ python: - nightly install: - pip install pyyaml flake8 flake8-import-order coveralls + - if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi - pip install . script: - - flake8 . + - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then flake8 .; fi - yamllint --strict $(git ls-files '*.yaml' '*.yml') - coverage run --source=yamllint setup.py test after_success: diff --git a/setup.py b/setup.py index 5d841ca..e87980f 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,5 @@ setup( package_data={'yamllint': ['conf/*.yaml'], 'tests': ['yaml-1.2-spec-examples/*']}, install_requires=['pathspec >=0.5.3', 'pyyaml'], - tests_require=['nose'], - test_suite='nose.collector', + test_suite='tests', ) diff --git a/tests/common.py b/tests/common.py index b5ba469..11dd235 100644 --- a/tests/common.py +++ b/tests/common.py @@ -16,7 +16,12 @@ import os import tempfile -import unittest +import sys +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest import yaml diff --git a/tests/test_cli.py b/tests/test_cli.py index ad0749f..bec7078 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -23,14 +23,19 @@ import locale import os import pty import shutil -import unittest import sys +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest from yamllint import cli from tests.common import build_temp_workspace +@unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported') class CommandLineTestCase(unittest.TestCase): @classmethod def setUpClass(cls): diff --git a/tests/test_config.py b/tests/test_config.py index d6485cc..a23da10 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -21,7 +21,11 @@ except ImportError: import os import shutil import sys -import unittest +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest from yamllint import cli from yamllint import config @@ -334,6 +338,7 @@ class IgnorePathConfigTestCase(unittest.TestCase): shutil.rmtree(cls.wd) + @unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported') def test_run_with_ignored_path(self): sys.stdout = StringIO() with self.assertRaises(SystemExit): diff --git a/tests/test_linter.py b/tests/test_linter.py index db126ad..edd803f 100644 --- a/tests/test_linter.py +++ b/tests/test_linter.py @@ -15,8 +15,12 @@ # along with this program. If not, see . import io - -import unittest +import sys +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest from yamllint.config import YamlLintConfig from yamllint import linter diff --git a/tests/test_module.py b/tests/test_module.py index 70cc42e..678f40c 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -18,9 +18,15 @@ import os import shutil import subprocess import tempfile -import unittest +import sys +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest +@unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported') class ModuleTestCase(unittest.TestCase): def setUp(self): self.wd = tempfile.mkdtemp(prefix='yamllint-tests-') diff --git a/tests/test_parser.py b/tests/test_parser.py index e40b9ac..c5c51d8 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -14,7 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import unittest +import sys +try: + assert sys.version_info >= (2, 7) + import unittest +except: + import unittest2 as unittest import yaml