diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-20 12:38:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-20 12:38:25 +0300 |
commit | 5442e725a5b534b8d843c9cd3c451eee167355b3 (patch) | |
tree | fc9d1d812ad19f7fddd2d4ed86fe16bbbbadd467 /source/tests | |
parent | 790e47768a850d4a7bfc0c9cb2da94d8f0e26336 (diff) |
print how many times the operator failed.
Diffstat (limited to 'source/tests')
-rw-r--r-- | source/tests/batch_import.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/tests/batch_import.py b/source/tests/batch_import.py index 627acbcdb6c..5c228c014ca 100644 --- a/source/tests/batch_import.py +++ b/source/tests/batch_import.py @@ -103,10 +103,12 @@ def batch_import(operator="", if len(files) != files_len: print(" using a subset in (%d, %d), total %d" % (start, end, len(files)), end="") - print("") - import bpy op = eval(operator) + + tot_done = 0 + tot_fail = 0 + for i, f in enumerate(files): print(" %s(filepath=%r) # %d of %d" % (operator, f, i + start, len(files))) @@ -118,7 +120,12 @@ def batch_import(operator="", addon_utils.reset_all = _reset_all # XXX, hack clear_scene() - op(filepath=f) + result = op(filepath=f) + + if 'FINISHED' in result: + tot_done += 1 + else: + tot_fail += 1 if save_path: fout = os.path.join(save_path, os.path.relpath(f, path)) @@ -132,6 +139,8 @@ def batch_import(operator="", bpy.ops.wm.save_as_mainfile(filepath=fout_blend) + print("finished, done:%d, fail:%d" % (tot_done, tot_fail)) + def main(): import optparse |