Skip to content

Commit 4c3a2a6

Browse files
committed
Add proper logging to tests when in verbose mode
1 parent 534cd1d commit 4c3a2a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/simple/_util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# http://arrayfire.com/licenses/BSD-3-Clause
88
########################################################
99

10+
import traceback
11+
import logging
1012
import arrayfire as af
1113

1214
def display_func(verbose):
@@ -34,7 +36,6 @@ def __init__(self):
3436
def run(self, name_list=None, verbose=False):
3537
test_list = name_list if name_list is not None else self.keys()
3638
for key in test_list:
37-
3839
try:
3940
test = self[key]
4041
except:
@@ -44,7 +45,10 @@ def run(self, name_list=None, verbose=False):
4445
try:
4546
test(verbose)
4647
print(self.print_str % (key, "PASSED"))
47-
except:
48+
except Exception as e:
4849
print(self.print_str % (key, "FAILED"))
50+
if (verbose):
51+
logging.error(traceback.format_exc())
52+
4953

5054
tests = _simple_test_dict()

0 commit comments

Comments
 (0)