tests: Add unittest aliases to Python 2.7
This commit is contained in:
committed by
Adrien Vergé
parent
11b1f1c14e
commit
cef0b48993
@@ -71,6 +71,11 @@ class CommandLineTestCase(unittest.TestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(CommandLineTestCase, cls).setUpClass()
|
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({
|
cls.wd = build_temp_workspace({
|
||||||
# .yaml file at root
|
# .yaml file at root
|
||||||
'a.yaml': '---\n'
|
'a.yaml': '---\n'
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ from yamllint import config
|
|||||||
|
|
||||||
|
|
||||||
class SimpleConfigTestCase(unittest.TestCase):
|
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):
|
def test_parse_config(self):
|
||||||
new = config.YamlLintConfig('rules:\n'
|
new = config.YamlLintConfig('rules:\n'
|
||||||
' colons:\n'
|
' colons:\n'
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ PYTHON = sys.executable or 'python'
|
|||||||
|
|
||||||
|
|
||||||
class ModuleTestCase(unittest.TestCase):
|
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):
|
def setUp(self):
|
||||||
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user