End support for Python 2

As planned and advertized, yamllint drops support for Python 2 on 2021.
This commit is contained in:
Adrien Vergé
2021-01-05 08:20:57 +01:00
parent ee4d163ff8
commit a3fc64d134
9 changed files with 8 additions and 55 deletions

View File

@@ -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
@@ -159,7 +156,6 @@ class LineLengthTestCase(RuleTestCase):
' {% 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'

View File

@@ -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
@@ -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'

View File

@@ -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
@@ -31,15 +28,6 @@ from yamllint import config
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'

View File

@@ -26,15 +26,6 @@ PYTHON = sys.executable or 'python'
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-')