From c281d4850772ad318449c40d9257889e2d7c42f5 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 24 Nov 2018 11:29:07 +0200 Subject: [PATCH] Drop support for EOL Python 2.6 --- .travis.yml | 13 +++---------- tests/common.py | 7 +------ tests/rules/test_line_length.py | 6 +----- tests/test_cli.py | 7 +------ tests/test_config.py | 7 +------ tests/test_linter.py | 7 +------ tests/test_module.py | 7 +------ tests/test_parser.py | 7 +------ 8 files changed, 10 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94cf9c2..c8980bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,19 @@ --- language: python python: - - 2.6 - 2.7 - 3.4 - 3.5 - 3.6 - nightly install: - - pip install pyyaml flake8 flake8-import-order - - if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi - - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pip install coveralls; fi + - pip install pyyaml coveralls flake8 flake8-import-order - if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then pip install sphinx; fi - pip install . script: - - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then flake8 .; fi + - flake8 . - yamllint --strict $(git ls-files '*.yaml' '*.yml') - - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then - coverage run --source=yamllint setup.py test; - else - python setup.py test; - fi + - coverage run --source=yamllint setup.py test - if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then python setup.py build_sphinx; fi diff --git a/tests/common.py b/tests/common.py index ddeb867..b5ba469 100644 --- a/tests/common.py +++ b/tests/common.py @@ -16,12 +16,7 @@ import os import tempfile -import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest import yaml diff --git a/tests/rules/test_line_length.py b/tests/rules/test_line_length.py index d052483..216317c 100644 --- a/tests/rules/test_line_length.py +++ b/tests/rules/test_line_length.py @@ -15,11 +15,7 @@ # along with this program. If not, see . import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest from tests.common import RuleTestCase diff --git a/tests/test_cli.py b/tests/test_cli.py index 6d570f3..29feb1a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -24,18 +24,13 @@ import os import pty import shutil import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest from tests.common import build_temp_workspace from yamllint import cli -@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 3b6b9c2..b5af3aa 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -21,11 +21,7 @@ except ImportError: import os import shutil import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest from tests.common import build_temp_workspace @@ -338,7 +334,6 @@ 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 6c7ae62..859a1e5 100644 --- a/tests/test_linter.py +++ b/tests/test_linter.py @@ -15,12 +15,7 @@ # along with this program. If not, see . import io -import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest from yamllint.config import YamlLintConfig from yamllint import linter diff --git a/tests/test_module.py b/tests/test_module.py index 8bdffcc..e1bf066 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -19,17 +19,12 @@ import shutil import subprocess import tempfile import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest PYTHON = sys.executable or 'python' -@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 7ed1f98..e40b9ac 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -14,12 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import sys -try: - assert sys.version_info >= (2, 7) - import unittest -except AssertionError: - import unittest2 as unittest +import unittest import yaml