[Python-modules-commits] [python-blessed] 01/03: Removes time based assertion in test_keyboard.py
Pierre-Elliott Bécue
peb-guest at moszumanska.debian.org
Tue Jan 9 07:49:08 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 9a0485e357a1e712d8bd95265138c7d22fcc2a70
Author: Pierre-Elliott Bécue <becue at crans.org>
Date: Sun Dec 31 13:12:44 2017 +0100
Removes time based assertion in test_keyboard.py
* 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 | 50 ------------------------------------------
1 file changed, 50 deletions(-)
diff --git a/blessed/tests/test_keyboard.py b/blessed/tests/test_keyboard.py
index 9df528d..c3c960e 100644
--- a/blessed/tests/test_keyboard.py
+++ b/blessed/tests/test_keyboard.py
@@ -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 34 <= int(duration_ms) <= 45, duration_ms
@pytest.mark.skipif(os.environ.get('TEST_QUICK', None) is not None,
@@ -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 134 <= int(duration_ms) <= 145, int(duration_ms)
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 34 <= int(duration_ms) <= 45, int(duration_ms)
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 -1 <= int(duration_ms) <= 15, duration_ms
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 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