summaryrefslogtreecommitdiff
path: root/blessings/tests/test_keyboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'blessings/tests/test_keyboard.py')
-rw-r--r--blessings/tests/test_keyboard.py90
1 files changed, 0 insertions, 90 deletions
diff --git a/blessings/tests/test_keyboard.py b/blessings/tests/test_keyboard.py
index ff4d518..74fdc5c 100644
--- a/blessings/tests/test_keyboard.py
+++ b/blessings/tests/test_keyboard.py
@@ -123,96 +123,6 @@ def test_char_is_ready_interrupted_nonetype():
assert math.floor(time.time() - stime) == 1.0
-def test_char_is_ready_interrupted_interruptable():
- "_char_is_ready() may be interrupted when interruptable=False."
- pid, master_fd = pty.fork()
- if pid == 0:
- try:
- cov = __import__('cov_core_init').init()
- except ImportError:
- cov = None
-
- # child pauses, writes semaphore and begins awaiting input
- global got_sigwinch
- got_sigwinch = False
-
- def on_resize(sig, action):
- global got_sigwinch
- got_sigwinch = True
-
- term = TestTerminal()
- signal.signal(signal.SIGWINCH, on_resize)
- read_until_semaphore(sys.__stdin__.fileno(), semaphore=SEMAPHORE)
- os.write(sys.__stdout__.fileno(), SEMAPHORE)
- with term.keystroke_input(raw=True):
- term.keystroke(timeout=1.05, interruptable=False)
- os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch
- if cov is not None:
- cov.stop()
- cov.save()
- os._exit(0)
-
- 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)
-
- pid, status = os.waitpid(pid, 0)
- assert output == u'complete'
- assert os.WEXITSTATUS(status) == 0
- assert math.floor(time.time() - stime) == 0.0
-
-
-def test_char_is_ready_interrupted_nonetype_interruptable():
- """_char_is_ready() may be interrupted when interruptable=False with
- timeout None."""
- pid, master_fd = pty.fork()
- if pid == 0:
- try:
- cov = __import__('cov_core_init').init()
- except ImportError:
- cov = None
-
- # child pauses, writes semaphore and begins awaiting input
- global got_sigwinch
- got_sigwinch = False
-
- def on_resize(sig, action):
- global got_sigwinch
- got_sigwinch = True
-
- term = TestTerminal()
- signal.signal(signal.SIGWINCH, on_resize)
- read_until_semaphore(sys.__stdin__.fileno(), semaphore=SEMAPHORE)
- os.write(sys.__stdout__.fileno(), SEMAPHORE)
- with term.keystroke_input(raw=True):
- term.keystroke(timeout=None, interruptable=False)
- os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch
- if cov is not None:
- cov.stop()
- cov.save()
- os._exit(0)
-
- 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)
- os.write(master_fd, b'X')
- 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) == 0.0
-
-
def test_keystroke_input_no_kb():
"keystroke_input() should not call tty.setcbreak() without keyboard."
@as_subprocess