summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Quast <contact@jeffquast.com>2015-03-08 13:50:06 -0700
committerJeff Quast <contact@jeffquast.com>2015-03-08 13:50:06 -0700
commite8ceb2a307a93d274756e68285abac9951d9a4b0 (patch)
treecd71dd177b098c249c963d525ed16f80f9f3c1e7
parente6d59fb3939fb35eb54b37e2b9ba72946f464137 (diff)
parent50e94dca624cc045d7df997b4f0b5675b70cbd43 (diff)
downloadblessings-e8ceb2a307a93d274756e68285abac9951d9a4b0.tar.gz
Merge remote-tracking branch 'origin/blessed-integration' into blessed-integration-docs-further-reading-and-growing-pains
Conflicts: setup.py
-rw-r--r--.coveragerc4
-rw-r--r--.prospector.yaml2
-rw-r--r--MANIFEST.in2
-rw-r--r--blessings/__init__.py2
-rw-r--r--blessings/_binterms.py3
-rw-r--r--blessings/keyboard.py2
-rw-r--r--blessings/sequences.py2
-rw-r--r--blessings/terminal.py42
-rw-r--r--blessings/tests/accessories.py2
-rw-r--r--blessings/tests/test_core.py38
-rw-r--r--blessings/tests/test_keyboard.py78
-rw-r--r--blessings/tests/test_sequences.py21
-rwxr-xr-xsetup.py8
-rwxr-xr-xtools/display-sighandlers.py6
-rwxr-xr-xtools/teamcity-runtests.sh3
-rw-r--r--tox.ini2
16 files changed, 116 insertions, 101 deletions
diff --git a/.coveragerc b/.coveragerc
index eb47214..078f566 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,6 +1,6 @@
[run]
branch = True
-source = blessed
+source = blessings
[report]
-omit = blessed/tests/*
+omit = blessings/tests/*
diff --git a/.prospector.yaml b/.prospector.yaml
index d6714ed..5d1f7d2 100644
--- a/.prospector.yaml
+++ b/.prospector.yaml
@@ -6,7 +6,7 @@ ignore:
- ^docs/
# ignore tests and bin/ for the moment, their quality does not so much matter.
- ^bin/
- - ^blessed/tests/
+ - ^blessings/tests/
test-warnings: true
diff --git a/MANIFEST.in b/MANIFEST.in
index 977c4ee..97fe640 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
include docs/intro.rst
include LICENSE
include tox.ini
-include blessed/tests/wall.ans
+include blessings/tests/wall.ans
diff --git a/blessings/__init__.py b/blessings/__init__.py
index 3622d0e..f5a65eb 100644
--- a/blessings/__init__.py
+++ b/blessings/__init__.py
@@ -13,4 +13,4 @@ if ('3', '0', '0') <= _platform.python_version_tuple() < ('3', '2', '2+'):
from .terminal import Terminal
-__all__ = ('Terminal',)
+__all__ = ['Terminal']
diff --git a/blessings/_binterms.py b/blessings/_binterms.py
index 6c93ee0..9621be5 100644
--- a/blessings/_binterms.py
+++ b/blessings/_binterms.py
@@ -707,7 +707,6 @@ tvi950-rv
tvi950-rv-2p
tvi950-rv-4p
tvipt
-unknown
vanilla
vc303
vc404
@@ -869,4 +868,4 @@ zen50
ztx
""".split()
-__all__ = ('binary_terminals',)
+__all__ = ['binary_terminals']
diff --git a/blessings/keyboard.py b/blessings/keyboard.py
index 77f75d6..b6c4c95 100644
--- a/blessings/keyboard.py
+++ b/blessings/keyboard.py
@@ -1,6 +1,6 @@
"This sub-module provides 'keyboard awareness'."
-__all__ = ('Keystroke', 'get_keyboard_codes', 'get_keyboard_sequences',)
+__all__ = ['Keystroke', 'get_keyboard_codes', 'get_keyboard_sequences']
import curses.has_key
import collections
diff --git a/blessings/sequences.py b/blessings/sequences.py
index bf0324b..902ae1b 100644
--- a/blessings/sequences.py
+++ b/blessings/sequences.py
@@ -1,7 +1,7 @@
# encoding: utf-8
" This sub-module provides 'sequence awareness' for blessings."
-__all__ = ('init_sequence_patterns', 'Sequence', 'SequenceTextWrapper',)
+__all__ = ['init_sequence_patterns', 'Sequence', 'SequenceTextWrapper']
# built-ins
import functools
diff --git a/blessings/terminal.py b/blessings/terminal.py
index 60fecbe..7374ff4 100644
--- a/blessings/terminal.py
+++ b/blessings/terminal.py
@@ -142,13 +142,13 @@ class Terminal(object):
"""
global _CUR_TERM
- self.keyboard_fd = None
+ self._keyboard_fd = None
# default stream is stdout, keyboard only valid as stdin when
# output stream is stdout and output stream is a tty
if stream is None or stream == sys.__stdout__:
stream = sys.__stdout__
- self.keyboard_fd = sys.__stdin__.fileno()
+ self._keyboard_fd = sys.__stdin__.fileno()
try:
stream_fd = (stream.fileno() if hasattr(stream, 'fileno')
@@ -160,10 +160,10 @@ class Terminal(object):
self._does_styling = ((self.is_a_tty or force_styling) and
force_styling is not None)
- # keyboard_fd only non-None if both stdin and stdout is a tty.
- self.keyboard_fd = (self.keyboard_fd
- if self.keyboard_fd is not None and
- self.is_a_tty and os.isatty(self.keyboard_fd)
+ # _keyboard_fd only non-None if both stdin and stdout is a tty.
+ self._keyboard_fd = (self._keyboard_fd
+ if self._keyboard_fd is not None and
+ self.is_a_tty and os.isatty(self._keyboard_fd)
else None)
self._normal = None # cache normal attr, preventing recursive lookups
@@ -218,7 +218,7 @@ class Terminal(object):
self._keymap = get_keyboard_sequences(self)
self._keyboard_buf = collections.deque()
- if self.keyboard_fd is not None:
+ if self._keyboard_fd is not None:
locale.setlocale(locale.LC_ALL, '')
self._encoding = locale.getpreferredencoding() or 'ascii'
try:
@@ -544,8 +544,8 @@ class Terminal(object):
Implementors of input streams other than os.read() on the stdin fd
should derive and override this method.
"""
- assert self.keyboard_fd is not None
- byte = os.read(self.keyboard_fd, 1)
+ assert self._keyboard_fd is not None
+ byte = os.read(self._keyboard_fd, 1)
return self._keyboard_decoder.decode(byte, final=False)
def _char_is_ready(self, timeout=None, interruptable=True):
@@ -567,7 +567,7 @@ class Terminal(object):
# we continue to block indefinitely (default).
stime = time.time()
check_w, check_x, ready_r = [], [], [None, ]
- check_r = [self.keyboard_fd] if self.keyboard_fd is not None else []
+ check_r = [self._keyboard_fd] if self._keyboard_fd is not None else []
while HAS_TTY and True:
try:
@@ -587,7 +587,7 @@ class Terminal(object):
else:
break
- return False if self.keyboard_fd is None else check_r == ready_r
+ return False if self._keyboard_fd is None else check_r == ready_r
@contextlib.contextmanager
def keystroke_input(self, raw=False):
@@ -614,16 +614,16 @@ class Terminal(object):
Note also that setcbreak sets VMIN = 1 and VTIME = 0,
http://www.unixwiz.net/techtips/termios-vmin-vtime.html
"""
- if HAS_TTY and self.keyboard_fd is not None:
+ if HAS_TTY and self._keyboard_fd is not None:
# Save current terminal mode:
- save_mode = termios.tcgetattr(self.keyboard_fd)
+ save_mode = termios.tcgetattr(self._keyboard_fd)
mode_setter = tty.setraw if raw else tty.setcbreak
- mode_setter(self.keyboard_fd, termios.TCSANOW)
+ mode_setter(self._keyboard_fd, termios.TCSANOW)
try:
yield
finally:
# Restore prior mode:
- termios.tcsetattr(self.keyboard_fd,
+ termios.tcsetattr(self._keyboard_fd,
termios.TCSAFLUSH,
save_mode)
else:
@@ -684,13 +684,13 @@ class Terminal(object):
# TODO(jquast): Ctrl characters, KEY_CTRL_[A-Z], and the rest;
# KEY_CTRL_\, KEY_CTRL_{, etc. are not legitimate
# attributes. comparator to term.KEY_ctrl('z') ?
-
- if timeout is None and self.keyboard_fd is None:
+
+ if timeout is None and self._keyboard_fd is None:
raise NoKeyboard(
- 'Waiting for a keystroke on a terminal with no keyboard '
- 'attached and no timeout would take a long time. Add a '
- 'timeout and revise your program logic.')
-
+ 'Waiting for a keystroke on a terminal with no keyboard '
+ 'attached and no timeout would take a long time. Add a '
+ 'timeout and revise your program logic.')
+
def time_left(stime, timeout):
"""time_left(stime, timeout) -> float
diff --git a/blessings/tests/accessories.py b/blessings/tests/accessories.py
index 8cb3f5b..28b21de 100644
--- a/blessings/tests/accessories.py
+++ b/blessings/tests/accessories.py
@@ -63,7 +63,7 @@ class as_subprocess(object):
def __call__(self, *args, **kwargs):
pid, master_fd = pty.fork()
- if pid is self._CHILD_PID:
+ if pid == self._CHILD_PID:
# child process executes function, raises exception
# if failed, causing a non-zero exit code, using the
# protected _exit() function of ``os``; to prevent the
diff --git a/blessings/tests/test_core.py b/blessings/tests/test_core.py
index ce1e838..bc7f7f1 100644
--- a/blessings/tests/test_core.py
+++ b/blessings/tests/test_core.py
@@ -30,7 +30,7 @@ import pytest
def test_export_only_Terminal():
"Ensure only Terminal instance is exported for import * statements."
import blessings
- assert blessings.__all__ == ('Terminal',)
+ assert blessings.__all__ == ['Terminal']
def test_null_location(all_terms):
@@ -107,7 +107,12 @@ def test_number_of_colors_without_tty():
@as_subprocess
def child_8_forcestyle():
- t = TestTerminal(kind='ansi', stream=StringIO(),
+ kind = 'ansi'
+ if platform.system().lower() == 'freebsd':
+ # 'ansi' on freebsd returns 0 colors, we use the 'cons25' driver,
+ # compatible with its kernel tty.c
+ kind = 'cons25'
+ t = TestTerminal(kind=kind, stream=StringIO(),
force_styling=True)
assert (t.number_of_colors == 8)
@@ -132,7 +137,12 @@ def test_number_of_colors_with_tty():
@as_subprocess
def child_8():
- t = TestTerminal(kind='ansi')
+ kind = 'ansi'
+ if platform.system().lower() == 'freebsd':
+ # 'ansi' on freebsd returns 0 colors, we use the 'cons25' driver,
+ # compatible with its kernel tty.c
+ kind = 'cons25'
+ t = TestTerminal(kind=kind)
assert (t.number_of_colors == 8)
@as_subprocess
@@ -201,9 +211,10 @@ def test_setupterm_singleton_issue33():
def test_setupterm_invalid_issue39():
"A warning is emitted if TERM is invalid."
# https://bugzilla.mozilla.org/show_bug.cgi?id=878089
-
+ #
# if TERM is unset, defaults to 'unknown', which should
- # fail to lookup and emit a warning, only.
+ # fail to lookup and emit a warning on *some* systems.
+ # freebsd actually has a termcap entry for 'unknown'
@as_subprocess
def child():
warnings.filterwarnings("error", category=UserWarning)
@@ -216,8 +227,9 @@ def test_setupterm_invalid_issue39():
"Failed to setupterm(kind='unknown'): "
"setupterm: could not find terminal")
else:
- assert not term.is_a_tty and not term.does_styling, (
- 'Should have thrown exception')
+ if platform.system().lower() != 'freebsd':
+ assert not term.is_a_tty and not term.does_styling, (
+ 'Should have thrown exception')
warnings.resetwarnings()
child()
@@ -233,9 +245,9 @@ def test_setupterm_invalid_has_no_styling():
def child():
warnings.filterwarnings("ignore", category=UserWarning)
- term = TestTerminal(kind='unknown', force_styling=True)
+ term = TestTerminal(kind='xxXunknownXxx', force_styling=True)
assert term.kind is None
- assert term.does_styling is False
+ assert not term.does_styling
assert term.number_of_colors == 0
warnings.resetwarnings()
@@ -322,9 +334,9 @@ def test_IOUnsupportedOperation():
term = TestTerminal(stream=mock_stream)
assert term.stream == mock_stream
- assert term.does_styling is False
- assert term.is_a_tty is False
- assert term.number_of_colors is 0
+ assert not term.does_styling
+ assert not term.is_a_tty
+ assert term.number_of_colors == 0
child()
@@ -440,7 +452,7 @@ def test_win32_missing_tty_modules(monkeypatch):
warnings.filterwarnings("ignore", category=UserWarning)
import blessings.terminal
imp.reload(blessings.terminal)
- assert blessings.terminal.HAS_TTY is False
+ assert not blessings.terminal.HAS_TTY
term = blessings.terminal.Terminal('ansi')
assert term.height == 24
assert term.width == 80
diff --git a/blessings/tests/test_keyboard.py b/blessings/tests/test_keyboard.py
index 393b248..46e53c2 100644
--- a/blessings/tests/test_keyboard.py
+++ b/blessings/tests/test_keyboard.py
@@ -43,7 +43,7 @@ if sys.version_info[0] == 3:
def test_char_is_ready_interrupted():
"_char_is_ready() should not be interrupted with a signal handler."
pid, master_fd = pty.fork()
- if pid is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -64,7 +64,7 @@ def test_char_is_ready_interrupted():
with term.keystroke_input(raw=True):
assert term.keystroke(timeout=1.05) == u''
os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch is True
+ assert got_sigwinch
if cov is not None:
cov.stop()
cov.save()
@@ -86,7 +86,7 @@ def test_char_is_ready_interrupted():
def test_char_is_ready_interrupted_nonetype():
"_char_is_ready() should also allow interruption with timeout of None."
pid, master_fd = pty.fork()
- if pid is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -107,7 +107,7 @@ def test_char_is_ready_interrupted_nonetype():
with term.keystroke_input(raw=True):
term.keystroke(timeout=1)
os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch is True
+ assert got_sigwinch
if cov is not None:
cov.stop()
cov.save()
@@ -130,7 +130,7 @@ def test_char_is_ready_interrupted_nonetype():
def test_char_is_ready_interrupted_interruptable():
"_char_is_ready() may be interrupted when interruptable=False."
pid, master_fd = pty.fork()
- if pid is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -151,7 +151,7 @@ def test_char_is_ready_interrupted_interruptable():
with term.keystroke_input(raw=True):
term.keystroke(timeout=1.05, interruptable=False)
os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch is True
+ assert got_sigwinch
if cov is not None:
cov.stop()
cov.save()
@@ -175,7 +175,7 @@ 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 is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -196,7 +196,7 @@ def test_char_is_ready_interrupted_nonetype_interruptable():
with term.keystroke_input(raw=True):
term.keystroke(timeout=None, interruptable=False)
os.write(sys.__stdout__.fileno(), b'complete')
- assert got_sigwinch is True
+ assert got_sigwinch
if cov is not None:
cov.stop()
cov.save()
@@ -226,12 +226,12 @@ def test_keystroke_input_no_kb():
with mock.patch("tty.setcbreak") as mock_setcbreak:
with term.keystroke_input():
assert not mock_setcbreak.called
- assert term.keyboard_fd is None
+ assert term._keyboard_fd is None
child()
def test_notty_kb_is_None():
- "keyboard_fd should be None when os.isatty returns False."
+ "term._keyboard_fd should be None when os.isatty returns False."
# in this scenerio, stream is sys.__stdout__,
# but os.isatty(0) is False,
# such as when piping output to less(1)
@@ -240,7 +240,7 @@ def test_notty_kb_is_None():
with mock.patch("os.isatty") as mock_isatty:
mock_isatty.return_value = False
term = TestTerminal()
- assert term.keyboard_fd is None
+ assert term._keyboard_fd is None
child()
@@ -253,7 +253,7 @@ def test_raw_input_no_kb():
with mock.patch("tty.setraw") as mock_setraw:
with term.keystroke_input(raw=True):
assert not mock_setraw.called
- assert term.keyboard_fd is None
+ assert term._keyboard_fd is None
child()
@@ -263,9 +263,9 @@ def test_char_is_ready_no_kb():
def child():
term = TestTerminal(stream=StringIO())
stime = time.time()
- assert term.keyboard_fd is None
- assert term._char_is_ready(timeout=1.1) is False
- assert (math.floor(time.time() - stime) == 1.0)
+ assert term._keyboard_fd is None
+ assert not term._char_is_ready(timeout=1.1)
+ assert math.floor(time.time() - stime) == 1.0
child()
@@ -324,7 +324,7 @@ def test_keystroke_1s_keystroke_input_noinput_nokb():
def test_keystroke_0s_keystroke_input_with_input():
"0-second keystroke with input; Keypress should be immediately returned."
pid, master_fd = pty.fork()
- if pid is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -357,7 +357,7 @@ def test_keystroke_0s_keystroke_input_with_input():
def test_keystroke_keystroke_input_with_input_slowly():
"0-second keystroke with input; Keypress should be immediately returned."
pid, master_fd = pty.fork()
- if pid is 0:
+ if pid == 0:
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -400,7 +400,7 @@ def test_keystroke_0s_keystroke_input_multibyte_utf8():
"0-second keystroke with multibyte utf-8 input; should decode immediately."
# utf-8 bytes represent "latin capital letter upsilon".
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -434,7 +434,7 @@ def test_keystroke_0s_keystroke_input_multibyte_utf8():
def test_keystroke_0s_raw_input_ctrl_c():
"0-second keystroke with raw allows receiving ^C."
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -467,7 +467,7 @@ def test_keystroke_0s_raw_input_ctrl_c():
def test_keystroke_0s_keystroke_input_sequence():
"0-second keystroke with multibyte sequence; should decode immediately."
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -497,7 +497,7 @@ def test_keystroke_0s_keystroke_input_sequence():
def test_keystroke_1s_keystroke_input_with_input():
"1-second keystroke w/multibyte sequence; should return after ~1 second."
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -529,7 +529,7 @@ def test_keystroke_1s_keystroke_input_with_input():
def test_esc_delay_keystroke_input_035():
"esc_delay will cause a single ESC (\\x1b) to delay for 0.35."
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -564,7 +564,7 @@ def test_esc_delay_keystroke_input_035():
def test_esc_delay_keystroke_input_135():
"esc_delay=1.35 will cause a single ESC (\\x1b) to delay for 1.35."
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -599,7 +599,7 @@ def test_esc_delay_keystroke_input_135():
def test_esc_delay_keystroke_input_timout_0():
"""esc_delay still in effect with timeout of 0 ("nonblocking")."""
pid, master_fd = pty.fork()
- if pid is 0: # child
+ if pid == 0: # child
try:
cov = __import__('cov_core_init').init()
except ImportError:
@@ -640,7 +640,7 @@ def test_keystroke_default_args():
assert ks._code is None
assert ks.code == ks._code
assert u'x' == u'x' + ks
- assert ks.is_sequence is False
+ assert not ks.is_sequence
assert repr(ks) in ("u''", # py26, 27
"''",) # py33
@@ -649,12 +649,12 @@ def test_a_keystroke():
"Test keyboard.Keystroke constructor with set arguments."
from blessings.keyboard import Keystroke
ks = Keystroke(ucs=u'x', code=1, name=u'the X')
- assert ks._name is u'the X'
+ assert ks._name == u'the X'
assert ks.name == ks._name
- assert ks._code is 1
+ assert ks._code == 1
assert ks.code == ks._code
assert u'xx' == u'x' + ks
- assert ks.is_sequence is True
+ assert ks.is_sequence
assert repr(ks) == "the X"
@@ -788,8 +788,8 @@ def test_resolve_sequence():
ks = resolve_sequence(u'', mapper, codes)
assert ks == u''
assert ks.name is None
- assert ks.code is None
- assert ks.is_sequence is False
+ assert ks.code == None
+ assert not ks.is_sequence
assert repr(ks) in ("u''", # py26, 27
"''",) # py33
@@ -797,35 +797,35 @@ def test_resolve_sequence():
assert ks == u'n'
assert ks.name is None
assert ks.code is None
- assert ks.is_sequence is False
+ assert not ks.is_sequence
assert repr(ks) in (u"u'n'", "'n'",)
ks = resolve_sequence(u'SEQ1', mapper, codes)
assert ks == u'SEQ1'
assert ks.name == u'KEY_SEQ1'
- assert ks.code is 1
- assert ks.is_sequence is True
+ assert ks.code == 1
+ assert ks.is_sequence
assert repr(ks) in (u"KEY_SEQ1", "KEY_SEQ1")
ks = resolve_sequence(u'LONGSEQ_longer', mapper, codes)
assert ks == u'LONGSEQ'
assert ks.name == u'KEY_LONGSEQ'
- assert ks.code is 4
- assert ks.is_sequence is True
+ assert ks.code == 4
+ assert ks.is_sequence
assert repr(ks) in (u"KEY_LONGSEQ", "KEY_LONGSEQ")
ks = resolve_sequence(u'LONGSEQ', mapper, codes)
assert ks == u'LONGSEQ'
assert ks.name == u'KEY_LONGSEQ'
- assert ks.code is 4
- assert ks.is_sequence is True
+ assert ks.code == 4
+ assert ks.is_sequence
assert repr(ks) in (u"KEY_LONGSEQ", "KEY_LONGSEQ")
ks = resolve_sequence(u'Lxxxxx', mapper, codes)
assert ks == u'L'
assert ks.name == u'KEY_L'
- assert ks.code is 6
- assert ks.is_sequence is True
+ assert ks.code == 6
+ assert ks.is_sequence
assert repr(ks) in (u"KEY_L", "KEY_L")
diff --git a/blessings/tests/test_sequences.py b/blessings/tests/test_sequences.py
index f42a52c..8d1597e 100644
--- a/blessings/tests/test_sequences.py
+++ b/blessings/tests/test_sequences.py
@@ -95,7 +95,6 @@ def test_stream_attr():
def test_emit_warnings_about_binpacked():
"""Test known binary-packed terminals (kermit, avatar) emit a warning."""
from blessings.sequences import _BINTERM_UNSUPPORTED_MSG
- from blessings._binterms import binary_terminals
@as_subprocess
def child(kind):
@@ -115,19 +114,25 @@ def test_emit_warnings_about_binpacked():
assert 'warnings should have been emitted.'
warnings.resetwarnings()
- # any binary terminal should do.
- child(binary_terminals[random.randrange(len(binary_terminals))])
+ # Although any binary terminal should do, FreeBSD has "termcap entry bugs"
+ # that cause false negatives, because their underlying curses library emits
+ # some kind of "warning" to stderr, which our @as_subprocess decorator
+ # determines to be noteworthy enough to fail the test:
+ # https://gist.github.com/jquast/7b90af251fe4000baa09
+ #
+ # so we chose only one of beautiful lineage:
+ # http://terminals.classiccmp.org/wiki/index.php/Tektronix_4207
+ child(kind='tek4207-s')
def test_unit_binpacked_unittest():
"""Unit Test known binary-packed terminals emit a warning (travis-safe)."""
import warnings
- from blessings._binterms import binary_terminals
from blessings.sequences import (_BINTERM_UNSUPPORTED_MSG,
init_sequence_patterns)
warnings.filterwarnings("error", category=UserWarning)
term = mock.Mock()
- term.kind = binary_terminals[random.randrange(len(binary_terminals))]
+ term.kind = 'tek4207-s'
try:
init_sequence_patterns(term)
@@ -192,8 +197,8 @@ def test_horizontal_location(all_terms):
assert (t.stream.getvalue() == expected_output), (
repr(t.stream.getvalue()), repr(expected_output))
- # skip 'screen', hpa is proxied (see later tests)
- if all_terms != 'screen':
+ # skip 'screen', 'ansi': hpa is proxied (see later tests)
+ if all_terms not in ('screen', 'ansi'):
child(all_terms)
@@ -211,7 +216,7 @@ def test_vertical_location(all_terms):
assert (t.stream.getvalue() == expected_output)
# skip 'screen', vpa is proxied (see later tests)
- if all_terms != 'screen':
+ if all_terms not in ('screen', 'ansi'):
child(all_terms)
diff --git a/setup.py b/setup.py
index 4c03c4d..6e832b0 100755
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,8 @@
#!/usr/bin/env python
-# std imports,
import subprocess
import sys
import os
-# 3rd-party
import setuptools
import setuptools.command.develop
import setuptools.command.test
@@ -34,7 +32,7 @@ def main():
'wcwidth>=0.1.0',
]
}
- if sys.version_info < (2, 7,):
+ if sys.version_info < (2, 7):
# we make use of collections.ordereddict: for python 2.6 we require the
# assistance of the 'orderddict' module which backports the same.
extra['install_requires'].extend(['ordereddict>=1.1'])
@@ -42,8 +40,8 @@ def main():
setuptools.setup(
name='blessings',
version='1.9.5',
- description=("A thin, practical wrapper around terminal coloring, "
- "styling, positioning, and keyboard input."),
+ description=('A thin, practical wrapper around terminal coloring, '
+ 'styling, positioning, and keyboard input.'),
long_description=open(os.path.join(here, 'docs/intro.rst')).read(),
author='Erik Rose, Jeff Quast',
author_email='erikrose@grinchcentral.com',
diff --git a/tools/display-sighandlers.py b/tools/display-sighandlers.py
index 98445e9..f3559f7 100755
--- a/tools/display-sighandlers.py
+++ b/tools/display-sighandlers.py
@@ -12,7 +12,11 @@ for name, value in [(signal_name, getattr(signal, signal_name))
for signal_name in dir(signal)
if signal_name.startswith('SIG')
and not signal_name.startswith('SIG_')]:
- handler = signal.getsignal(value)
+ try:
+ handler = signal.getsignal(value)
+ except ValueError:
+ # FreeBSD: signal number out of range
+ handler = 'out of range'
description = {
signal.SIG_IGN: "ignored(SIG_IGN)",
signal.SIG_DFL: "default(SIG_DFL)"
diff --git a/tools/teamcity-runtests.sh b/tools/teamcity-runtests.sh
index 07b06e9..3b3faec 100755
--- a/tools/teamcity-runtests.sh
+++ b/tools/teamcity-runtests.sh
@@ -1,7 +1,4 @@
#!/bin/bash
-#
-# This script assumes that the project 'ptyprocess' is
-# available in the parent of the project's folder.
set -e
set -o pipefail
diff --git a/tox.ini b/tox.ini
index b3894b2..40b9b6f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -19,7 +19,7 @@ deps = pytest-xdist
commands = {envbindir}/py.test \
--strict --junit-xml=results.{envname}.xml \
--verbose --verbose \
- --cov blessings blessings/tests --cov-report=term-missing \
+ --cov blessings --cov-report=term-missing \
{posargs}
/bin/mv {toxinidir}/.coverage {toxinidir}/.coverage.{envname}