End support for Python 2
As planned and advertized, yamllint drops support for Python 2 on 2021.
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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-')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user