File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def __init__(self):
68
68
atexit .register (setattr , self , 'in_atexit' , True )
69
69
70
70
def __repr__ (self ):
71
- return "<PyTracer at { }: {} lines in {} files>" .format (
71
+ return "<PyTracer at 0x{:x }: {} lines in {} files>" .format (
72
72
id (self ),
73
73
sum (len (v ) for v in self .data .values ()),
74
74
len (self .data ),
@@ -267,8 +267,10 @@ def stop(self):
267
267
# has changed to None.
268
268
dont_warn = (env .PYPY and env .PYPYVERSION >= (5 , 4 ) and self .in_atexit and tf is None )
269
269
if (not dont_warn ) and tf != self ._trace : # pylint: disable=comparison-with-callable
270
- msg = f"Trace function changed, measurement is likely wrong: { tf !r} "
271
- self .warn (msg , slug = "trace-changed" )
270
+ self .warn (
271
+ f"Trace function changed, data is likely wrong: { tf !r} != { self ._trace !r} " ,
272
+ slug = "trace-changed" ,
273
+ )
272
274
273
275
def activity (self ):
274
276
"""Has there been any activity?"""
Original file line number Diff line number Diff line change 4
4
"""Oddball cases for testing coverage.py"""
5
5
6
6
import os .path
7
+ import re
7
8
import sys
8
9
9
10
from flaky import flaky
@@ -132,7 +133,13 @@ def recur(n):
132
133
133
134
# Get a warning about the stackoverflow effect on the tracing function.
134
135
if pytrace : # pragma: no metacov
135
- assert cov ._warnings == ["Trace function changed, measurement is likely wrong: None" ]
136
+ assert len (cov ._warnings ) == 1
137
+ assert re .fullmatch (
138
+ r"Trace function changed, data is likely wrong: None != " +
139
+ r"<bound method PyTracer._trace of " +
140
+ "<PyTracer at 0x[0-9a-fA-F]+: 5 lines in 1 files>>" ,
141
+ cov ._warnings [0 ],
142
+ )
136
143
else :
137
144
assert not cov ._warnings
138
145
You can’t perform that action at this time.
0 commit comments