diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-10 21:46:53 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-10 21:46:53 +0100 |
commit | cf3fd3cf62b624b492a8f9cdfc72867ab7305767 (patch) | |
tree | 0e9aff68dcc4074cdd6b2996949c997101bc7100 | |
parent | a0c62a17f539adc4b1a13eec3d3d0f99081a0f33 (diff) | |
parent | 13ff05e4518b3892f7ea7ebe495f23a868a29baa (diff) | |
download | ttystatus-cf3fd3cf62b624b492a8f9cdfc72867ab7305767.tar.gz |
Merge: Python 3 support
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | check | 25 | ||||
-rw-r--r-- | debian/control | 9 | ||||
-rw-r--r-- | ttystatus/fmt_tests.py | 4 | ||||
-rw-r--r-- | ttystatus/status_tests.py | 12 |
5 files changed, 42 insertions, 10 deletions
@@ -7,6 +7,8 @@ Version 0.35+git, not yet released * The sphinx formatted manual is dropped. It was too much of a bother to maintain, sorry. Also, out of date. +* `ttystatus` is not ported to Python 3. + Version 0.35, released 2017-06-03 ---------------------------------- @@ -2,7 +2,26 @@ set -eu -python -m CoverageTestRunner --ignore-missing-from=without-tests +title() +{ + printf '\n\n%s\n' "$@" + for i in $(seq 77) + do + printf "-" + done + printf '\n' +} + +title "Python2 unit tests" +python2 -m CoverageTestRunner --ignore-missing-from=without-tests +rm -f .coverage + +title "Python3 unit tests" +python3 -m CoverageTestRunner --ignore-missing-from=without-tests rm -f .coverage -pep8 ttystatus -PYTHONPATH=. pylint --rcfile=pylint.conf ttystatus + +title "Style checks" +pycodestyle ttystatus + +title "Static checks" +PYTHONPATH=. pylint3 --rcfile=pylint.conf ttystatus diff --git a/debian/control b/debian/control index c693877..04d0d75 100644 --- a/debian/control +++ b/debian/control @@ -4,8 +4,13 @@ Homepage: http://liw.fi/ttystatus/ Section: python Priority: optional Standards-Version: 3.9.8 -Build-Depends: debhelper (>= 9), python (>= 2.7~), - python-coverage-test-runner, python-sphinx, pep8, pylint +Build-Depends: debhelper (>= 9), + python (>= 2.7~), + python3, + python-coverage-test-runner, + python3-coverage-test-runner, + pycodestyle, + pylint3 X-Python-Version: >= 2.7 Package: python-ttystatus diff --git a/ttystatus/fmt_tests.py b/ttystatus/fmt_tests.py index 4582d00..8c01ae9 100644 --- a/ttystatus/fmt_tests.py +++ b/ttystatus/fmt_tests.py @@ -23,9 +23,9 @@ class FormatTests(unittest.TestCase): def test_knows_widgets(self): self.assertEqual(type(ttystatus.fmt.widgets), list) - self.assert_(len(ttystatus.fmt.widgets) > 0) + self.assertTrue(len(ttystatus.fmt.widgets) > 0) for widget in ttystatus.fmt.widgets: - self.assert_(issubclass(widget, ttystatus.Widget)) + self.assertTrue(issubclass(widget, ttystatus.Widget)) self.assertNotEqual(widget, ttystatus.Widget) def test_parses_string_without_widgets(self): diff --git a/ttystatus/status_tests.py b/ttystatus/status_tests.py index 92425ac..5b8cd09 100644 --- a/ttystatus/status_tests.py +++ b/ttystatus/status_tests.py @@ -14,12 +14,18 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -import StringIO +import io as StringIO import unittest import ttystatus +if 'unicode' in __builtins__: + make_text = __builtins__['unicode'] +else: + make_text = str + + class DummyMessager(object): def __init__(self): @@ -37,7 +43,7 @@ class DummyMessager(object): return True def write(self, string, force=False): - self.written.write(string) + self.written.write(make_text(string)) def notify(self, string, f, force=False): pass @@ -130,7 +136,7 @@ class TerminalStatusTests(unittest.TestCase): def test_enable_calls_messager_enable(self): self.ts.disable() self.ts.enable() - self.assert_(self.ts._m.enabled) + self.assertTrue(self.ts._m.enabled) def test_counts_correctly_even_without_rendering(self): w = ttystatus.Counter('value') |