Skip to content

Commit

Permalink
Merge 30a8995 into ee4d163
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienverge committed Jan 5, 2021
2 parents ee4d163 + 30a8995 commit afaf250
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 55 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Expand Up @@ -2,7 +2,6 @@
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
language: python
python:
- 2.7
- 3.5
- 3.6
- 3.7
Expand All @@ -13,17 +12,14 @@ env:
- REMOVE_LOCALES=false
- REMOVE_LOCALES=true
install:
- pip install pyyaml coveralls flake8 flake8-import-order doc8
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then pip install sphinx; fi
- pip install pyyaml coveralls flake8 flake8-import-order doc8 sphinx
- pip install .
- if [[ $REMOVE_LOCALES = "true" ]]; then sudo rm -rf /usr/lib/locale/*; fi
script:
- if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then doc8 $(git ls-files '*.rst'); fi
- doc8 $(git ls-files '*.rst')
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
- coverage run --source=yamllint -m unittest discover
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then
python setup.py build_sphinx;
fi
- python setup.py build_sphinx
after_success:
coveralls
6 changes: 1 addition & 5 deletions README.rst
Expand Up @@ -19,11 +19,7 @@ indentation, etc.
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
:alt: Documentation status

Written in Python (compatible with Python 2 & 3).

⚠ Python 2 upstream support stopped on January 1, 2020. yamllint will keep
best-effort support for Python 2.7 until January 1, 2021. Past that date,
yamllint will drop all Python 2-related code.
Written in Python (compatible with Python 3 only).

Documentation
-------------
Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Expand Up @@ -26,8 +26,6 @@ classifiers =
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Expand All @@ -48,7 +46,7 @@ project_urls =
[options]
packages = find:

python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
python_requires = >=3.5.*

include_package_data = True
install_requires =
Expand Down
4 changes: 0 additions & 4 deletions tests/rules/test_line_length.py
Expand Up @@ -14,9 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys
import unittest

from tests.common import RuleTestCase


Expand Down Expand Up @@ -159,7 +156,6 @@ def test_non_breakable_inline_mappings(self):
' {% this line is' + 99 * ' really' + ' long %}\n',
conf, problem=(3, 81))

@unittest.skipIf(sys.version_info < (3, 0), 'Python 2 not supported')
def test_unicode(self):
conf = 'line-length: {max: 53}'
self.check('---\n'
Expand Down
10 changes: 1 addition & 9 deletions tests/test_cli.py
Expand Up @@ -14,10 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from io import StringIO
import fcntl
import locale
import os
Expand Down Expand Up @@ -71,11 +68,6 @@ class CommandLineTestCase(unittest.TestCase):
def setUpClass(cls):
super(CommandLineTestCase, cls).setUpClass()

# https://docs.python.org/3/library/unittest.html#deprecated-aliases
if sys.version_info < (3, 2):
cls.assertRegex = cls.assertRegexpMatches
cls.assertRaisesRegex = cls.assertRaisesRegexp

cls.wd = build_temp_workspace({
# .yaml file at root
'a.yaml': '---\n'
Expand Down
14 changes: 1 addition & 13 deletions tests/test_config.py
Expand Up @@ -14,10 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from io import StringIO
import os
import shutil
import sys
Expand All @@ -31,15 +28,6 @@


class SimpleConfigTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(SimpleConfigTestCase, cls).setUpClass()

# https://docs.python.org/3/library/unittest.html#deprecated-aliases
if sys.version_info < (3, 2):
cls.assertRegex = cls.assertRegexpMatches
cls.assertRaisesRegex = cls.assertRaisesRegexp

def test_parse_config(self):
new = config.YamlLintConfig('rules:\n'
' colons:\n'
Expand Down
9 changes: 0 additions & 9 deletions tests/test_module.py
Expand Up @@ -26,15 +26,6 @@


class ModuleTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(ModuleTestCase, cls).setUpClass()

# https://docs.python.org/3/library/unittest.html#deprecated-aliases
if sys.version_info < (3, 2):
cls.assertRegex = cls.assertRegexpMatches
cls.assertRaisesRegex = cls.assertRaisesRegexp

def setUp(self):
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')

Expand Down
2 changes: 1 addition & 1 deletion yamllint/linter.py
Expand Up @@ -233,7 +233,7 @@ def run(input, conf, filepath=None):
if conf.is_file_ignored(filepath):
return ()

if isinstance(input, (type(b''), type(u''))): # compat with Python 2 & 3
if isinstance(input, (bytes, str)):
return _run(input, conf, filepath)
elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase
# We need to have everything in memory to parse correctly
Expand Down
4 changes: 0 additions & 4 deletions yamllint/rules/line_length.py
Expand Up @@ -17,10 +17,6 @@
"""
Use this rule to set a limit to lines length.
Note: with Python 2, the ``line-length`` rule may not work properly with
unicode characters because of the way strings are represented in bytes. We
recommend running yamllint with Python 3.
.. rubric:: Options
* ``max`` defines the maximal (inclusive) length of lines.
Expand Down

0 comments on commit afaf250

Please sign in to comment.