TestCaseExecutor: Only log AST representation when logging is at debug level. The conversion from AST to str is potentially expensive.
@@ -123,6 +123,7 @@ class TestCaseExecutor(AbstractExecutor):
):
for idx, node in enumerate(self._ast_nodes):
try:
+ if self._logger.isEnabledFor(logging.DEBUG):
self._logger.debug("Executing %s", astor.to_source(node))
code = compile(self.wrap_node_in_module(node), "<ast>", "exec")
if config.INSTANCE.measure_coverage:
