File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,7 @@ def time_it
73
73
74
74
timeout = ENV . fetch ( "TEST_TIMEOUT" , 10 ) . to_i
75
75
Timeout . timeout ( timeout , Timeout ::Error , "Test took over #{ timeout } seconds to finish" ) do
76
- profile = StackProf . run ( mode : :wall , interval : 1000 ) do
77
- yield
78
- end
79
- puts
80
- StackProf ::Report . new ( profile ) . print_text
76
+ yield
81
77
end
82
78
ensure
83
79
self . time = Minitest . clock_time - t0
@@ -86,16 +82,27 @@ def time_it
86
82
87
83
88
84
module DebugSlowTests
89
- def enable_extension! ( ... )
85
+ def wrap_the_thing ( name )
90
86
t0 = Minitest . clock_time
91
- super
92
- puts "enable_extension! took #{ Minitest . clock_time - t0 } seconds"
87
+ profile = StackProf . run ( mode : :wall , interval : 1000 ) do
88
+ rv = yield
89
+ end
90
+ puts
91
+ puts "#{ name } took #{ Minitest . clock_time - t0 } seconds"
92
+ puts
93
+ StackProf ::Report . new ( profile ) . print_text
94
+ rv
95
+ end
96
+ def enable_extension! ( ...)
97
+ wrap_the_thing ( __method__ ) do
98
+ super
99
+ end
93
100
end
94
101
95
102
def disable_extension! ( ...)
96
- t0 = Minitest . clock_time
97
- super
98
- puts "disable_extension! took #{ Minitest . clock_time - t0 } seconds"
103
+ wrap_the_thing ( __method__ ) do
104
+ super
105
+ end
99
106
end
100
107
end
101
108
You can’t perform that action at this time.
0 commit comments