tests: Mark log files to use utf-8 encoding

This seems to be needed when using python3 in VM for the ssid_utf8 test
case debug prints from the control interface requests. This breaks
python2 support for the same logging entries, but there does not seem to
be any easy way of addressing this in a manner that works for both
python versions, so move ahead with the python3-only support from now
on.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-02-18 18:19:06 +02:00 committed by Jouni Malinen
parent 432496cdd8
commit 5a3a131993

View file

@ -333,7 +333,7 @@ def main():
logger.addHandler(stdout_handler) logger.addHandler(stdout_handler)
file_name = os.path.join(args.logdir, 'run-tests.log') file_name = os.path.join(args.logdir, 'run-tests.log')
log_handler = logging.FileHandler(file_name) log_handler = logging.FileHandler(file_name, encoding='utf-8')
log_handler.setLevel(logging.DEBUG) log_handler.setLevel(logging.DEBUG)
fmt = "%(asctime)s %(levelname)s %(message)s" fmt = "%(asctime)s %(levelname)s %(message)s"
log_formatter = logging.Formatter(fmt) log_formatter = logging.Formatter(fmt)
@ -460,7 +460,7 @@ def main():
log_handler.stream.close() log_handler.stream.close()
logger.removeHandler(log_handler) logger.removeHandler(log_handler)
file_name = os.path.join(args.logdir, name + '.log') file_name = os.path.join(args.logdir, name + '.log')
log_handler = logging.FileHandler(file_name) log_handler = logging.FileHandler(file_name, encoding='utf-8')
log_handler.setLevel(logging.DEBUG) log_handler.setLevel(logging.DEBUG)
log_handler.setFormatter(log_formatter) log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler) logger.addHandler(log_handler)
@ -630,7 +630,7 @@ def main():
log_handler.stream.close() log_handler.stream.close()
logger.removeHandler(log_handler) logger.removeHandler(log_handler)
file_name = os.path.join(args.logdir, 'run-tests.log') file_name = os.path.join(args.logdir, 'run-tests.log')
log_handler = logging.FileHandler(file_name) log_handler = logging.FileHandler(file_name, encoding='utf-8')
log_handler.setLevel(logging.DEBUG) log_handler.setLevel(logging.DEBUG)
log_handler.setFormatter(log_formatter) log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler) logger.addHandler(log_handler)