Browse Source

test.py: force correct terminal width for spawned scripts

MMGen 5 years ago
parent
commit
7ebfac59fd
3 changed files with 7 additions and 1 deletions
  1. 2 0
      mmgen/globalvars.py
  2. 1 1
      mmgen/tw.py
  3. 4 0
      test/test.py

+ 2 - 0
mmgen/globalvars.py

@@ -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',

+ 1 - 1
mmgen/tw.py

@@ -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 '

+ 4 - 0
test/test.py

@@ -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':