From 3e5f3ce0680ba2037d75f98f47dd9f422bd8bb37 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 10 Nov 2017 21:42:01 +0100 Subject: Add: run unit tests with both Python 2 and 3 Also, prettify source and output. --- check | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/check b/check index 819058f..808c8a2 100755 --- a/check +++ b/check @@ -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 -- cgit v1.2.1 From 07c65509121c3badf1eaccd9072b7dbcab3fdacf Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 10 Nov 2017 21:42:43 +0100 Subject: Add: port to Python3 --- ttystatus/fmt_tests.py | 4 ++-- ttystatus/status_tests.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) 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 . -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') -- cgit v1.2.1 From 62a17fd14454ab6796b91d9f82222c7d6529642e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 10 Nov 2017 21:44:35 +0100 Subject: Add: update build-depenencies for Python3 --- debian/control | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- cgit v1.2.1 From 13ff05e4518b3892f7ea7ebe495f23a868a29baa Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 10 Nov 2017 21:46:31 +0100 Subject: Add: update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index da17f26..f0e36e9 100644 --- a/NEWS +++ b/NEWS @@ -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 ---------------------------------- -- cgit v1.2.1