Skip to content

Commit 9dc5365

Browse files
committed
make sure hard reset in tests won't interfere with tests not using it
1 parent 88e252d commit 9dc5365

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

spec/concurrent/actress_spec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ def backdoor(&block)
1515

1616
describe 'Concurrent::Actress' do
1717
prepend_before do
18-
@do_not_reset = true
19-
@@isolated_from_other_tests ||= begin
20-
sleep 0.1
21-
true
22-
end
18+
do_no_reset!
2319
end
2420

2521
def terminate_actors(*actors)

spec/support/example_group_extensions.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ def rbx?
2222
RbConfig::CONFIG['ruby_install_name']=~ /^rbx$/i
2323
end
2424

25+
def do_no_reset!
26+
@do_not_reset = true
27+
end
28+
29+
@@killed = false
30+
2531
def reset_gem_configuration
26-
return if @do_not_reset
27-
Concurrent.instance_variable_get(:@configuration).value = Concurrent::Configuration.new
32+
Concurrent.instance_variable_get(:@configuration).value = Concurrent::Configuration.new if @@killed
33+
@@killed = false
2834
end
2935

3036
def kill_rogue_threads(warning = true)
@@ -33,6 +39,7 @@ def kill_rogue_threads(warning = true)
3339
Thread.list.each do |thread|
3440
thread.kill unless thread == Thread.current
3541
end
42+
@@killed = true
3643
end
3744

3845
extend self

0 commit comments

Comments
 (0)