Merging upstream version 0.15.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
470a4841cc
commit
3213982697
75 changed files with 1281 additions and 1555 deletions
|
@ -1,19 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
try:
|
||||
# python 2.x
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
# python 3.x
|
||||
from io import StringIO
|
||||
from io import StringIO
|
||||
|
||||
|
||||
try:
|
||||
# python 2.x
|
||||
from mock import patch
|
||||
except ImportError:
|
||||
# python 3.x
|
||||
from unittest.mock import patch # pylint: disable=no-name-in-module, import-error
|
||||
from unittest.mock import patch # pylint: disable=no-name-in-module, import-error
|
||||
|
||||
from gitlint.display import Display
|
||||
from gitlint.config import LintConfig
|
||||
|
@ -28,21 +17,21 @@ class DisplayTests(BaseTestCase):
|
|||
with patch('gitlint.display.stderr', new=StringIO()) as stderr:
|
||||
# Non exact outputting, should output both v and vv output
|
||||
with patch('gitlint.display.stdout', new=StringIO()) as stdout:
|
||||
display.v(u"tëst")
|
||||
display.vv(u"tëst2")
|
||||
display.v("tëst")
|
||||
display.vv("tëst2")
|
||||
# vvvv should be ignored regardless
|
||||
display.vvv(u"tëst3.1")
|
||||
display.vvv(u"tëst3.2", exact=True)
|
||||
self.assertEqual(u"tëst\ntëst2\n", stdout.getvalue())
|
||||
display.vvv("tëst3.1")
|
||||
display.vvv("tëst3.2", exact=True)
|
||||
self.assertEqual("tëst\ntëst2\n", stdout.getvalue())
|
||||
|
||||
# exact outputting, should only output v
|
||||
with patch('gitlint.display.stdout', new=StringIO()) as stdout:
|
||||
display.v(u"tëst", exact=True)
|
||||
display.vv(u"tëst2", exact=True)
|
||||
display.v("tëst", exact=True)
|
||||
display.vv("tëst2", exact=True)
|
||||
# vvvv should be ignored regardless
|
||||
display.vvv(u"tëst3.1")
|
||||
display.vvv(u"tëst3.2", exact=True)
|
||||
self.assertEqual(u"tëst2\n", stdout.getvalue())
|
||||
display.vvv("tëst3.1")
|
||||
display.vvv("tëst3.2", exact=True)
|
||||
self.assertEqual("tëst2\n", stdout.getvalue())
|
||||
|
||||
# standard error should be empty throughtout all of this
|
||||
self.assertEqual('', stderr.getvalue())
|
||||
|
@ -54,21 +43,21 @@ class DisplayTests(BaseTestCase):
|
|||
with patch('gitlint.display.stdout', new=StringIO()) as stdout:
|
||||
# Non exact outputting, should output both v and vv output
|
||||
with patch('gitlint.display.stderr', new=StringIO()) as stderr:
|
||||
display.e(u"tëst")
|
||||
display.ee(u"tëst2")
|
||||
display.e("tëst")
|
||||
display.ee("tëst2")
|
||||
# vvvv should be ignored regardless
|
||||
display.eee(u"tëst3.1")
|
||||
display.eee(u"tëst3.2", exact=True)
|
||||
self.assertEqual(u"tëst\ntëst2\n", stderr.getvalue())
|
||||
display.eee("tëst3.1")
|
||||
display.eee("tëst3.2", exact=True)
|
||||
self.assertEqual("tëst\ntëst2\n", stderr.getvalue())
|
||||
|
||||
# exact outputting, should only output v
|
||||
with patch('gitlint.display.stderr', new=StringIO()) as stderr:
|
||||
display.e(u"tëst", exact=True)
|
||||
display.ee(u"tëst2", exact=True)
|
||||
display.e("tëst", exact=True)
|
||||
display.ee("tëst2", exact=True)
|
||||
# vvvv should be ignored regardless
|
||||
display.eee(u"tëst3.1")
|
||||
display.eee(u"tëst3.2", exact=True)
|
||||
self.assertEqual(u"tëst2\n", stderr.getvalue())
|
||||
display.eee("tëst3.1")
|
||||
display.eee("tëst3.2", exact=True)
|
||||
self.assertEqual("tëst2\n", stderr.getvalue())
|
||||
|
||||
# standard output should be empty throughtout all of this
|
||||
self.assertEqual('', stdout.getvalue())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue