From aa0b657e58c91c079738cbc3fc0df11749fddf09 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 24 Mar 2019 11:01:22 +0100 Subject: [PATCH] Add Session.__repr__ --- src/_pytest/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 3effbfb6e..4e3700b1e 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -441,6 +441,15 @@ class Session(nodes.FSCollector): self.config.pluginmanager.register(self, name="session") + def __repr__(self): + return "<%s %s exitstatus=%r testsfailed=%d testscollected=%d>" % ( + self.__class__.__name__, + self.name, + getattr(self, "exitstatus", ""), + self.testsfailed, + self.testscollected, + ) + def _node_location_to_relpath(self, node_path): # bestrelpath is a quite slow function return self._bestrelpathcache[node_path]