test.py: log, error filename cleanups

This commit is contained in:
The MMGen Project 2023-09-29 12:24:21 +00:00
commit a0ffe37a58
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 12 additions and 12 deletions

View file

@ -44,10 +44,6 @@ def help_notes_func(proto,cfg,k):
from ..seedsplit import MasterShareIdx
return MasterShareIdx
def test_py_log_file():
from test.test_py_d.common import log_file
return log_file
def tool_help():
from ..tool.help import main_help
return main_help()

View file

@ -66,7 +66,8 @@ def exec_wrapper_write_traceback(e,exit_val):
sys.stdout.write('{}\n{}\n'.format( c.yellow( '\n'.join(tb_lines) ), c.red(exc_line) ))
with open('test.py.err','w') as fp:
from test.include.common import test_py_error_fn
with open(test_py_error_fn,'w') as fp:
fp.write('\n'.join(tb_lines + [exc_line]))
else:
sys.stdout.write( c.purple((f'NONZERO_EXIT[{exit_val}]: ' if exit_val else '') + exc_line) + '\n' )

View file

@ -56,6 +56,9 @@ def strip_ansi_escapes(s):
import re
return re.sub('\x1b' + r'\[[;0-9]+?m','',s)
test_py_log_fn = 'test.py.log'
test_py_error_fn = 'test.py.err'
ascii_uc = ''.join(map(chr,list(range(65,91)))) # 26 chars
ascii_lc = ''.join(map(chr,list(range(97,123)))) # 26 chars
lat_accent = ''.join(map(chr,list(range(192,383)))) # 191 chars, L,S

View file

@ -93,8 +93,10 @@ from mmgen.common import *
from mmgen.devinit import init_dev
init_dev()
from test.include.common import set_globals,test_py_log_fn,test_py_error_fn
try:
os.unlink(os.path.join(repo_root,'test.py.err'))
os.unlink(os.path.join(repo_root,test_py_error_fn))
except:
pass
@ -165,7 +167,7 @@ environment var
},
'code': {
'options': lambda proto,help_notes,s: s.format(
lf = help_notes('test_py_log_file')
lf = test_py_log_fn
)
}
}
@ -173,7 +175,7 @@ environment var
# we need some opt values before running opts.init, so parse without initializing:
po = Config(opts_data=opts_data,parse_only=True)._parsed_opts
from test.include.common import set_globals,get_test_data_dir
from test.include.common import get_test_data_dir
data_dir = get_test_data_dir() # include/common.py
@ -540,9 +542,9 @@ class TestSuiteRunner(object):
self.deps_only = None
if cfg.log:
self.log_fd = open(log_file,'a')
self.log_fd = open(test_py_log_fn,'a')
self.log_fd.write(f'\nLog started: {make_timestr()} UTC\n')
omsg(f'INFO → Logging to file {log_file!r}')
omsg(f'INFO → Logging to file {test_py_log_fn!r}')
else:
self.log_fd = None

View file

@ -25,8 +25,6 @@ from mmgen.cfg import gc
from mmgen.util import msg
from ..include.common import *
log_file = 'test.py.log'
rt_pw = 'abc-α'
ref_wallet_brainpass = 'abc'
ref_wallet_hash_preset = '1'