From 461731d71cf27faa6295bc759941f402fedc88e4 Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Mon, 14 Sep 2020 04:25:19 +0300 Subject: [PATCH] Fix reproduce file formatting (use flow style) Set flow style (JSON-like) explicitly instead of block style to don't break indentation. Before the patch (incorrect): | - - app-tap/iconv.test.lua | - null After the patch: | - [app-tap/iconv.test.lua, null] The default was changed in [1]. [1]: https://github.com/yaml/pyyaml/pull/256 --- dispatcher.py | 3 ++- lib/worker.py | 3 ++- listeners.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dispatcher.py b/dispatcher.py index 64772de8..cedd3556 100644 --- a/dispatcher.py +++ b/dispatcher.py @@ -255,7 +255,8 @@ def report_undone(self, verbose): 'queue, but were not reported as done (does not matters ' 'success or fail):\n', schema='test_var') for task_id in undone: - color_stdout('- %s' % yaml.safe_dump(task_id)) + task_id_str = yaml.safe_dump(task_id, default_flow_style=True) + color_stdout('- %s' % task_id_str) else: # Visually continue StatisticsWatcher.print_statistics() output. color_stdout('* undone: %d\n' % len(undone), schema='test_var') diff --git a/lib/worker.py b/lib/worker.py index 86852fa1..de3ee563 100644 --- a/lib/worker.py +++ b/lib/worker.py @@ -300,7 +300,8 @@ def run_task(self, task_id): try: task = self.find_task(task_id) with open(self.reproduce_file, 'a') as f: - f.write('- ' + yaml.safe_dump(task.id)) + task_id_str = yaml.safe_dump(task.id, default_flow_style=True) + f.write('- ' + task_id_str) short_status = self.suite.run_test( task, self.server, self.inspector) except KeyboardInterrupt: diff --git a/listeners.py b/listeners.py index cc41c528..c4d6fcc9 100644 --- a/listeners.py +++ b/listeners.py @@ -60,7 +60,8 @@ def print_statistics(self): color_stdout('Failed tasks:\n', schema='test_var') for task_id, worker_name, show_reproduce_content in self.failed_tasks: logfile = self.get_logfile(worker_name) - color_stdout('- %s' % yaml.safe_dump(task_id), schema='test_var') + task_id_str = yaml.safe_dump(task_id, default_flow_style=True) + color_stdout('- %s' % task_id_str, schema='test_var') color_stdout('# logfile: %s\n' % logfile) reproduce_file_path = get_reproduce_file(worker_name) color_stdout('# reproduce file: %s\n' % reproduce_file_path)