Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ylobankov committed Mar 21, 2023
1 parent 63171e1 commit d03af63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def sigterm_handler(self, signum, frame):
def __init__(self, suite, _id):
self.sigterm_received = False
signal.signal(signal.SIGTERM, lambda x, y, z=self:
z.sigterm_handler(x, y))
z.sigterm_handler(x, y))

self.initialized = False
self.server = None
Expand Down
4 changes: 2 additions & 2 deletions listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def print_statistics(self):
final_report('* %s: %d\n' % (short_status, cnt), schema='test_var')

if not self.failed_tasks:
return False, self.flaked_tasks
return False, bool(self.flaked_tasks)

final_report('Failed tasks:\n', schema='test_var')
for task_id, worker_name, show_reproduce_content in self.failed_tasks:
Expand All @@ -185,7 +185,7 @@ def print_statistics(self):
print_tail_n(reproduce_file_path)
color_stdout("...\n", schema='separator')

return True, self.flaked_tasks
return True, bool(self.flaked_tasks)


class ArtifactsWatcher(BaseWatcher):
Expand Down
10 changes: 4 additions & 6 deletions test-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def main_loop_consistent(failed_test_ids):
for name, task_group in task_groups:
# print information about current test suite
color_stdout("\n", '=' * 80, "\n", schema='separator')
color_stdout("TEST".ljust(48), schema='t_name')
color_stdout("PARAMS".ljust(16), schema='test_var')
color_stdout("RESULT\n", schema='test_pass')
color_stdout('-' * 75, "\n", schema='separator')
color_stdout("TEST".ljust(48), schema='t_name')
color_stdout("PARAMS".ljust(16), schema='test_var')
color_stdout("RESULT\n", schema='test_pass')
color_stdout('-' * 75, "\n", schema='separator')

task_ids = task_group['task_ids']
show_reproduce_content = task_group['show_reproduce_content']
Expand Down Expand Up @@ -312,7 +312,6 @@ def show_env():
if PY3 and sys.version_info[0:2] < (3, 7):
std_open = __builtins__.open


def open_as_utf8(*args, **kwargs):
if len(args) >= 2:
mode = args[1]
Expand All @@ -322,7 +321,6 @@ def open_as_utf8(*args, **kwargs):
kwargs.setdefault('encoding', 'utf-8')
return std_open(*args, **kwargs)


__builtins__.open = open_as_utf8

# don't sure why, but it values 1 or 2 gives 1.5x speedup for parallel
Expand Down

0 comments on commit d03af63

Please sign in to comment.