Skip to content

Commit d747b21

Browse files
pfalconpi-anl
authored andcommitted
unittest: Only treat callable fields as test methods.
Signed-off-by: Paul Sokolovsky <[email protected]>
1 parent c72ec5c commit d747b21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,10 @@ def run_class(c, test_result):
223223
exceptions = []
224224
for name in dir(o):
225225
if name.startswith("test"):
226-
print("%s (%s) ..." % (name, c.__qualname__), end="")
227226
m = getattr(o, name)
227+
if not callable(m):
228+
continue
229+
print("%s (%s) ..." % (name, c.__qualname__), end="")
228230
set_up()
229231
try:
230232
test_result.testsRun += 1

0 commit comments

Comments
 (0)