test.py: force correct terminal width for spawned scripts

This commit is contained in:
The MMGen Project 2019-05-27 15:40:13 +00:00
commit 7ebfac59fd
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 7 additions and 1 deletions

View file

@ -105,6 +105,7 @@ class g(object):
traceback = False
test_suite = False
test_suite_popen_spawn = False
terminal_width = 0
# warnings
mswin_pw_warning = True
@ -173,6 +174,7 @@ class g(object):
'MMGEN_TEST_SUITE',
'MMGEN_TEST_SUITE_POPEN_SPAWN',
'MMGEN_TERMINAL_WIDTH',
'MMGEN_BOGUS_WALLET_DATA',
'MMGEN_BOGUS_SEND',
'MMGEN_DEBUG',

View file

@ -169,7 +169,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
def set_term_columns(self):
from mmgen.term import get_terminal_size
while True:
self.cols = get_terminal_size()[0]
self.cols = g.terminal_width or get_terminal_size()[0]
if self.cols >= g.min_screen_width: break
m1 = 'Screen too narrow to display the tracking wallet\n'
m2 = 'Please resize your screen to at least {} characters and hit ENTER '

View file

@ -407,6 +407,10 @@ def create_tmp_dirs(shm_dir):
os.symlink(src,cfgs[cfg]['tmpdir'])
def set_environ_for_spawned_scripts():
from mmgen.term import get_terminal_size
os.environ['MMGEN_TERMINAL_WIDTH'] = str(get_terminal_size()[0])
if os.getenv('MMGEN_DEBUG_ALL'):
for name in g.env_opts:
if name[:11] == 'MMGEN_DEBUG':