Skip to content

Commit e18b43d

Browse files
author
Sylvain MARIE
committed
Lazy values (so, test cases) now have a much nicer string representation ; in particular in pytest-harvest results tables. Fixes #112
1 parent cb78f43 commit e18b43d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pytest_cases/common_pytest_lazy_values.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ def get(self):
6262
"""Return the value to use by pytest"""
6363
raise NotImplementedError()
6464

65-
if not pytest53:
66-
def __str__(self):
67-
"""in pytest<5.3 we inherit from int so that str(v) is called by pytest _idmaker to get the id"""
68-
return self.get_id()
65+
def __str__(self):
66+
"""in pytest<5.3 we inherit from int so that str(v) is called by pytest _idmaker to get the id
67+
68+
In later pytest this is extremely convenient to have this string representation
69+
for example to use in pytest-harvest results tables, so we still keep it.
70+
"""
71+
return self.get_id()
6972

7073
@property
7174
def __name__(self):

0 commit comments

Comments
 (0)