Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail in non-interactive terminals #117

Closed
sbraz opened this issue Jan 30, 2016 · 2 comments
Closed

Tests fail in non-interactive terminals #117

sbraz opened this issue Jan 30, 2016 · 2 comments

Comments

@sbraz
Copy link

sbraz commented Jan 30, 2016

Hi,
some tests currently fail when ran in a non-interactive terminal which makes automated testing difficult.
I'm not sure this is expected since most of your tests use a fake Terminal on purpose, so I'm assuming the ones that don't should work even in a non-interactive term.

Can you fix it or is this something we should work around?

Here is the error:

running test
running egg_info
writing blessings.egg-info/PKG-INFO
writing top-level names to blessings.egg-info/top_level.txt
writing dependency_links to blessings.egg-info/dependency_links.txt
reading manifest file 'blessings.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'blessings.egg-info/SOURCES.txt'
running build_ext
blessings.tests.test_capability
Check that a capability lookup works. ... ERROR
blessings.tests.test_capability_without_tty
Assert capability templates are '' when stream is not a tty. ... ok
blessings.tests.test_capability_with_forced_tty
If we force styling, capabilities had better not (generally) be ... ok
blessings.tests.test_parametrization
Test parametrizing a capability. ... FAIL
blessings.tests.test_height_and_width
Assert that ``height_and_width()`` returns ints. ... FAIL
blessings.tests.test_stream_attr
Make sure Terminal exposes a ``stream`` attribute that defaults to ... ok
blessings.tests.test_location
Make sure ``location()`` does what it claims. ... ok
blessings.tests.test_horizontal_location
Make sure we can move the cursor horizontally without changing rows. ... ok
blessings.tests.test_null_location
Make sure ``location()`` with no args just does position restoration. ... ok
blessings.tests.test_zero_location
Make sure ``location()`` pays attention to 0-valued args. ... ok
blessings.tests.test_null_fileno
Make sure ``Terminal`` works when ``fileno`` is ``None``. ... ok
blessings.tests.test_mnemonic_colors
Make sure color shortcuts work. ... FAIL
blessings.tests.test_callable_numeric_colors
``color(n)`` should return a formatting wrapper. ... ok
blessings.tests.test_null_callable_numeric_colors
``color(n)`` should be a no-op on null terminals. ... ok
blessings.tests.test_naked_color_cap
``term.color`` should return a stringlike capability. ... ok
blessings.tests.test_number_of_colors_without_tty
``number_of_colors`` should return 0 when there's no tty. ... SKIP
blessings.tests.test_number_of_colors_with_tty
``number_of_colors`` should work. ... ok
blessings.tests.test_formatting_functions
Test crazy-ass formatting wrappers, both simple and compound. ... ok
blessings.tests.test_formatting_functions_without_tty
Test crazy-ass formatting wrappers when there's no tty. ... ok
blessings.tests.test_nice_formatting_errors
Make sure you get nice hints if you misspell a formatting wrapper. ... ok
blessings.tests.test_init_descriptor_always_initted
We should be able to get a height and width even on no-tty Terminals. ... FAIL
blessings.tests.test_force_styling_none
If ``force_styling=None`` is passed to the constructor, don't ever do ... ok
blessings.tests.test_null_callable_string
Make sure NullCallableString tolerates all numbers and kinds of args it ... ok

======================================================================
ERROR: blessings.tests.test_capability
Check that a capability lookup works.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 47, in test_capability
    sc = unicode_cap('sc')
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 31, in unicode_cap
    return tigetstr(cap).decode('latin1')
error: must call (at least) setupterm() first

======================================================================
FAIL: blessings.tests.test_parametrization
Test parametrizing a capability.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 68, in test_parametrization
    eq_(TestTerminal().cup(3, 4), unicode_parm('cup', 3, 4))
AssertionError: u'' != u'\x1b[4;5H'

======================================================================
FAIL: blessings.tests.test_height_and_width
Assert that ``height_and_width()`` returns ints.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 74, in test_height_and_width
    assert isinstance(t.height, int)
AssertionError

======================================================================
FAIL: blessings.tests.test_mnemonic_colors
Make sure color shortcuts work.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 149, in test_mnemonic_colors
    eq_(t.white, color(7))
AssertionError: u'' != u'\x1b[37m'

======================================================================
FAIL: blessings.tests.test_init_descriptor_always_initted
We should be able to get a height and width even on no-tty Terminals.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jo/compil/blessings-1.6/blessings/tests.py", line 254, in test_init_descriptor_always_initted
    eq_(type(t.height), int)
AssertionError: <type 'NoneType'> != <type 'int'>

----------------------------------------------------------------------
Ran 23 tests in 0.009s

FAILED (failures=4, errors=1, skipped=1)

@jquast
Copy link
Collaborator

jquast commented Jan 30, 2016

same as #25

@sbraz
Copy link
Author

sbraz commented Jan 30, 2016

Hi @jquast, sorry about the duplicate bug. Do you think it's possible to merge this branch into master and make a new release?

@sbraz sbraz closed this as completed Jan 30, 2016
sbraz pushed a commit to sbraz/blessed that referenced this issue Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants