From: Jouni Malinen Date: Mon, 18 Feb 2019 16:19:06 +0000 (+0200) Subject: tests: Mark log files to use utf-8 encoding X-Git-Tag: hostap_2_8~351 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a3a1319931a87ba8bcc652b09aeeb18b8aee6ed;p=thirdparty%2Fhostap.git 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 --- diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 2fe8ed866..2b8d4d25e 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -333,7 +333,7 @@ def main(): logger.addHandler(stdout_handler) 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) fmt = "%(asctime)s %(levelname)s %(message)s" log_formatter = logging.Formatter(fmt) @@ -460,7 +460,7 @@ def main(): log_handler.stream.close() logger.removeHandler(log_handler) 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.setFormatter(log_formatter) logger.addHandler(log_handler) @@ -630,7 +630,7 @@ def main(): log_handler.stream.close() logger.removeHandler(log_handler) 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.setFormatter(log_formatter) logger.addHandler(log_handler)