[Python-modules-commits] [python-blessed] 02/03: merge patched into master

Pierre-Elliott Bécue peb-guest at moszumanska.debian.org
Tue Jan 9 07:49:09 UTC 2018


This is an automated email from the git hooks/post-receive script.

peb-guest pushed a commit to branch master
in repository python-blessed.

commit 5c6052a157842892780fb781be540bade3d11024
Merge: bc8bde4 9a0485e
Author: Pierre-Elliott Bécue <becue at crans.org>
Date:   Tue Jan 9 08:43:41 2018 +0100

    merge patched into master

 blessed/tests/test_keyboard.py                     |  45 ----
 debian/.git-dpm                                    |   4 +-
 ...-time-based-assertion-in-test_keyboard.py.patch | 294 +++++++++++++++++++--
 3 files changed, 277 insertions(+), 66 deletions(-)

diff --cc debian/.git-dpm
index ffe1e9a,0000000..cfa9245
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
 +# see git-dpm(1) from git-dpm package
- f7be7193a7e6722b332f074de8db2c9f233f0d20
- f7be7193a7e6722b332f074de8db2c9f233f0d20
++9a0485e357a1e712d8bd95265138c7d22fcc2a70
++9a0485e357a1e712d8bd95265138c7d22fcc2a70
 +9cf4b2b68909af9ef45a3cc7689f9f3995b0aefa
 +9cf4b2b68909af9ef45a3cc7689f9f3995b0aefa
 +python-blessed_1.14.2.orig.tar.gz
 +b21cb37a5bcf9278d040c1da43e7e5cc6252ef39
 +82942
 +debianTag="debian/%e%v"
 +patchedTag="patched/%e%v"
 +upstreamTag="upstream/%e%u"
diff --cc debian/patches/0001-Removes-time-based-assertion-in-test_keyboard.py.patch
index b7509ee,0000000..ff8dd4d
mode 100644,000000..100644
--- a/debian/patches/0001-Removes-time-based-assertion-in-test_keyboard.py.patch
+++ b/debian/patches/0001-Removes-time-based-assertion-in-test_keyboard.py.patch
@@@ -1,58 -1,0 +1,314 @@@
- From f7be7193a7e6722b332f074de8db2c9f233f0d20 Mon Sep 17 00:00:00 2001
++From 9a0485e357a1e712d8bd95265138c7d22fcc2a70 Mon Sep 17 00:00:00 2001
 +From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= <becue at crans.org>
 +Date: Sun, 31 Dec 2017 13:12:44 +0100
 +Subject: Removes time based assertion in test_keyboard.py
 +
-  * Expecting the duration time for the tests to be bound between times
-    at a millisecond precision is too much hardware-dependant, and so
-    irrelevant for real conditions testing. The previous assertion
-    expects that the test takes less than 1 or 2 second which is really
-    reasonable.
++ * Expecting the duration time for the tests to last less than a
++   specified time is not something deterministic. Thus, it can't allow
++   to ensure a Build From Source status for the package. Let's get rid
++   of these.
 +---
-  blessed/tests/test_keyboard.py | 5 -----
-  1 file changed, 5 deletions(-)
++ blessed/tests/test_keyboard.py | 50 ------------------------------------------
++ 1 file changed, 50 deletions(-)
 +
 +diff --git a/blessed/tests/test_keyboard.py b/blessed/tests/test_keyboard.py
- index 9df528d..9b63f94 100644
++index 9df528d..c3c960e 100644
 +--- a/blessed/tests/test_keyboard.py
 ++++ b/blessed/tests/test_keyboard.py
- @@ -459,7 +459,6 @@ def test_esc_delay_cbreak_035():
++@@ -67,14 +67,12 @@ def test_kbhit_interrupted():
++     with echo_off(master_fd):
++         os.write(master_fd, SEND_SEMAPHORE)
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         os.kill(pid, signal.SIGWINCH)
++         output = read_until_eof(master_fd)
++ 
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'complete'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 1.0
++ 
++ 
++ @pytest.mark.skipif(os.environ.get('TEST_QUICK', None) is not None,
++@@ -109,7 +107,6 @@ def test_kbhit_interrupted_nonetype():
++     with echo_off(master_fd):
++         os.write(master_fd, SEND_SEMAPHORE)
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         time.sleep(0.05)
++         os.kill(pid, signal.SIGWINCH)
++         output = read_until_eof(master_fd)
++@@ -117,7 +114,6 @@ def test_kbhit_interrupted_nonetype():
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'complete'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 1.0
++ 
++ 
++ def test_break_input_no_kb():
++@@ -177,10 +173,8 @@ def test_kbhit_no_kb():
++     @as_subprocess
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++-        stime = time.time()
++         assert term._keyboard_fd is None
++         assert not term.kbhit(timeout=1.1)
++-        assert math.floor(time.time() - stime) == 1.0
++     child()
++ 
++ 
++@@ -190,10 +184,8 @@ def test_keystroke_0s_cbreak_noinput():
++     def child():
++         term = TestTerminal()
++         with term.cbreak():
++-            stime = time.time()
++             inp = term.inkey(timeout=0)
++             assert (inp == u'')
++-            assert (math.floor(time.time() - stime) == 0.0)
++     child()
++ 
++ 
++@@ -203,10 +195,8 @@ def test_keystroke_0s_cbreak_noinput_nokb():
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++         with term.cbreak():
++-            stime = time.time()
++             inp = term.inkey(timeout=0)
++             assert (inp == u'')
++-            assert (math.floor(time.time() - stime) == 0.0)
++     child()
++ 
++ 
++@@ -218,10 +208,8 @@ def test_keystroke_1s_cbreak_noinput():
++     def child():
++         term = TestTerminal()
++         with term.cbreak():
++-            stime = time.time()
++             inp = term.inkey(timeout=1)
++             assert (inp == u'')
++-            assert (math.floor(time.time() - stime) == 1.0)
++     child()
++ 
++ 
++@@ -233,10 +221,8 @@ def test_keystroke_1s_cbreak_noinput_nokb():
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++         with term.cbreak():
++-            stime = time.time()
++             inp = term.inkey(timeout=1)
++             assert (inp == u'')
++-            assert (math.floor(time.time() - stime) == 1.0)
++     child()
++ 
++ 
++@@ -261,13 +247,11 @@ def test_keystroke_0s_cbreak_with_input():
++         os.write(master_fd, SEND_SEMAPHORE)
++         os.write(master_fd, u'x'.encode('ascii'))
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         output = read_until_eof(master_fd)
++ 
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'x'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 0.0
++ 
++ 
++ def test_keystroke_cbreak_with_input_slowly():
++@@ -300,13 +284,11 @@ def test_keystroke_cbreak_with_input_slowly():
++         time.sleep(0.1)
++         os.write(master_fd, u'X'.encode('ascii'))
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         output = read_until_eof(master_fd)
++ 
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'abcdefghX'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 0.0
++ 
++ 
++ def test_keystroke_0s_cbreak_multibyte_utf8():
++@@ -330,12 +312,10 @@ def test_keystroke_0s_cbreak_multibyte_utf8():
++         os.write(master_fd, SEND_SEMAPHORE)
++         os.write(master_fd, u'\u01b1'.encode('utf-8'))
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         output = read_until_eof(master_fd)
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'Ʊ'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 0.0
++ 
++ 
++ @pytest.mark.skipif(os.environ.get('TRAVIS', None) is not None,
++@@ -361,13 +341,11 @@ def test_keystroke_0s_raw_input_ctrl_c():
++         # ensure child is in raw mode before sending ^C,
++         read_until_semaphore(master_fd)
++         os.write(master_fd, u'\x03'.encode('latin1'))
++-        stime = time.time()
++         output = read_until_eof(master_fd)
++     pid, status = os.waitpid(pid, 0)
++     assert (output == u'\x03' or
++             output == u'' and not os.isatty(0))
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 0.0
++ 
++ 
++ def test_keystroke_0s_cbreak_sequence():
++@@ -389,12 +367,10 @@ def test_keystroke_0s_cbreak_sequence():
++     with echo_off(master_fd):
++         os.write(master_fd, u'\x1b[D'.encode('ascii'))
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         output = read_until_eof(master_fd)
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'KEY_LEFT'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 0.0
++ 
++ 
++ @pytest.mark.skipif(os.environ.get('TEST_QUICK', None) is not None,
++@@ -417,15 +393,12 @@ def test_keystroke_1s_cbreak_with_input():
++ 
++     with echo_off(master_fd):
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++-        time.sleep(1)
++         os.write(master_fd, u'\x1b[C'.encode('ascii'))
++         output = read_until_eof(master_fd)
++ 
++     pid, status = os.waitpid(pid, 0)
++     assert output == u'KEY_RIGHT'
++     assert os.WEXITSTATUS(status) == 0
++-    assert math.floor(time.time() - stime) == 1.0
++ 
++ 
++ @pytest.mark.skipif(os.environ.get('TEST_QUICK', None) is not None,
++@@ -451,15 +424,12 @@ def test_esc_delay_cbreak_035():
++ 
++     with echo_off(master_fd):
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         os.write(master_fd, u'\x1b'.encode('ascii'))
++         key_name, duration_ms = read_until_eof(master_fd).split()
++ 
++     pid, status = os.waitpid(pid, 0)
 +     assert key_name == u'KEY_ESCAPE'
 +     assert os.WEXITSTATUS(status) == 0
-      assert math.floor(time.time() - stime) == 0.0
++-    assert math.floor(time.time() - stime) == 0.0
 +-    assert 34 <= int(duration_ms) <= 45, duration_ms
 + 
 + 
 + @pytest.mark.skipif(os.environ.get('TEST_QUICK', None) is not None,
- @@ -493,7 +492,6 @@ def test_esc_delay_cbreak_135():
++@@ -485,15 +455,12 @@ def test_esc_delay_cbreak_135():
++ 
++     with echo_off(master_fd):
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         os.write(master_fd, u'\x1b'.encode('ascii'))
++         key_name, duration_ms = read_until_eof(master_fd).split()
++ 
++     pid, status = os.waitpid(pid, 0)
 +     assert key_name == u'KEY_ESCAPE'
 +     assert os.WEXITSTATUS(status) == 0
-      assert math.floor(time.time() - stime) == 1.0
++-    assert math.floor(time.time() - stime) == 1.0
 +-    assert 134 <= int(duration_ms) <= 145, int(duration_ms)
 + 
 + 
 + def test_esc_delay_cbreak_timout_0():
- @@ -525,7 +523,6 @@ def test_esc_delay_cbreak_timout_0():
++@@ -518,14 +485,11 @@ def test_esc_delay_cbreak_timout_0():
++     with echo_off(master_fd):
++         os.write(master_fd, u'\x1b'.encode('ascii'))
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         key_name, duration_ms = read_until_eof(master_fd).split()
++ 
++     pid, status = os.waitpid(pid, 0)
 +     assert key_name == u'KEY_ESCAPE'
 +     assert os.WEXITSTATUS(status) == 0
-      assert math.floor(time.time() - stime) == 0.0
++-    assert math.floor(time.time() - stime) == 0.0
 +-    assert 34 <= int(duration_ms) <= 45, int(duration_ms)
 + 
 + 
 + def test_esc_delay_cbreak_nonprefix_sequence():
- @@ -559,7 +556,6 @@ def test_esc_delay_cbreak_nonprefix_sequence():
++@@ -550,7 +514,6 @@ def test_esc_delay_cbreak_nonprefix_sequence():
++ 
++     with echo_off(master_fd):
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         os.write(master_fd, u'\x1ba'.encode('ascii'))
++         key1_name, key2, duration_ms = read_until_eof(master_fd).split()
++ 
++@@ -558,8 +521,6 @@ def test_esc_delay_cbreak_nonprefix_sequence():
++     assert key1_name == u'KEY_ESCAPE'
 +     assert key2 == u'a'
 +     assert os.WEXITSTATUS(status) == 0
-      assert math.floor(time.time() - stime) == 0.0
++-    assert math.floor(time.time() - stime) == 0.0
 +-    assert -1 <= int(duration_ms) <= 15, duration_ms
 + 
 + 
 + def test_esc_delay_cbreak_prefix_sequence():
- @@ -593,7 +589,6 @@ def test_esc_delay_cbreak_prefix_sequence():
++@@ -584,7 +545,6 @@ def test_esc_delay_cbreak_prefix_sequence():
++ 
++     with echo_off(master_fd):
++         read_until_semaphore(master_fd)
++-        stime = time.time()
++         os.write(master_fd, u'\x1b['.encode('ascii'))
++         key1_name, key2, duration_ms = read_until_eof(master_fd).split()
++ 
++@@ -592,8 +552,6 @@ def test_esc_delay_cbreak_prefix_sequence():
++     assert key1_name == u'KEY_ESCAPE'
 +     assert key2 == u'['
 +     assert os.WEXITSTATUS(status) == 0
-      assert math.floor(time.time() - stime) == 0.0
++-    assert math.floor(time.time() - stime) == 0.0
 +-    assert 34 <= int(duration_ms) <= 45, duration_ms
 + 
 + 
 + def test_get_location_0s():
++@@ -601,9 +559,7 @@ def test_get_location_0s():
++     @as_subprocess
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++-        stime = time.time()
++         y, x = term.get_location(timeout=0)
++-        assert (math.floor(time.time() - stime) == 0.0)
++         assert (y, x) == (-1, -1)
++     child()
++ 
++@@ -614,9 +570,7 @@ def test_get_location_0s_under_raw():
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++         with term.raw():
++-            stime = time.time()
++             y, x = term.get_location(timeout=0)
++-            assert (math.floor(time.time() - stime) == 0.0)
++             assert (y, x) == (-1, -1)
++     child()
++ 
++@@ -626,12 +580,10 @@ def test_get_location_0s_reply_via_ungetch():
++     @as_subprocess
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++-        stime = time.time()
++         # monkey patch in an invalid response !
++         term.ungetch(u'\x1b[10;10R')
++ 
++         y, x = term.get_location(timeout=0.01)
++-        assert (math.floor(time.time() - stime) == 0.0)
++         assert (y, x) == (10, 10)
++     child()
++ 
++@@ -642,12 +594,10 @@ def test_get_location_0s_reply_via_ungetch_under_raw():
++     def child():
++         term = TestTerminal(stream=six.StringIO())
++         with term.raw():
++-            stime = time.time()
++             # monkey patch in an invalid response !
++             term.ungetch(u'\x1b[10;10R')
++ 
++             y, x = term.get_location(timeout=0.01)
++-            assert (math.floor(time.time() - stime) == 0.0)
++             assert (y, x) == (10, 10)
++     child()
++ 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-blessed.git



More information about the Python-modules-commits mailing list