Default the worker number to 0 not NaN
If 'NaN' then the worker balance summary will fail with a TypeError. 0 makes sense in the common cases: * either you have worker tags and they are numbered * or you have no worker tags and thus you have just one worker, and we can call that worker '0' because it is the first one The 'NaN' shows up when you try to use subunit-trace in commands such as python -m subunit.run discover <dir|package> |subunit-trace which is something people are wont to do. Change-Id: Ibe18f16c0c360fc5a995fcf84e5bf2b6c16abd9c
This commit is contained in:
@@ -81,10 +81,15 @@ def get_duration(timestamps):
|
||||
|
||||
|
||||
def find_worker(test):
|
||||
"""Get the worker number.
|
||||
|
||||
If there are no workers because we aren't in a concurrent environment,
|
||||
assume the worker number is 0.
|
||||
"""
|
||||
for tag in test['tags']:
|
||||
if tag.startswith('worker-'):
|
||||
return int(tag[7:])
|
||||
return 'NaN'
|
||||
return 0
|
||||
|
||||
|
||||
# Print out stdout/stderr if it exists, always
|
||||
|
Reference in New Issue
Block a user