-
Notifications
You must be signed in to change notification settings - Fork 957
Open
Description
I found a bug with relative_time when used with a generator. The times shown seem to be reset at some point. I don't know whether this bug could also happen without generators.
@iory Can you take a look at this bug?
@alexmojaki I suspect that this has something to do with the start_times dict you suggested.
Sample:
import pysnooper
import time
def g():
time.sleep(0.1)
yield 8
time.sleep(0.1)
@pysnooper.snoop(relative_time=True)
def f():
time.sleep(0.1)
yield from g()
time.sleep(0.1)
tuple(f())Output:
Source path:... C:\Users\Administrator\Desktop\fuck.py
00:00:00.000000 call 10 def f():
00:00:00.000000 line 11 time.sleep(0.1)
00:00:00.100000 line 12 yield from g()
00:00:00.200000 return 12 yield from g()
Return value:.. 8
Elapsed time: 00:00:00.200000
00:00:00.000000 call 12 yield from g()
00:00:00.100000 exception 12 yield from g()
StopIteration
00:00:00.100000 line 13 time.sleep(0.1)
00:00:00.207002 return 13 time.sleep(0.1)
Return value:.. None
Elapsed time: 00:00:00.207002
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels