Skip to content

Stop rescuing all exceptions.

gitlab-qa-bot requested to merge stop-rescuing-all-exceptions into master

Created by: myronmarston

We do want to generally rescue Exception and any subclasses but there are a few exceptions we should not rescue. For example, if we rescue SystemExit, it prevents exit from exiting.

Attempted fix for #2058 (closed).

Note that the spec I added failed without these changes and passes with it...but there are some other weird effects that I do not understand:

➜  rspec-core git:(stop-rescuing-all-exceptions) bin/rspec spec/integration
Run options:
  include {:focus=>true}
  exclude {:ruby=>#<Proc:./spec/spec_helper.rb:106>}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 9279
...........

Finished in 2.12 seconds (files took 0.11962 seconds to load)
11 examples, 0 failures

Randomized with seed 9279

.......

Finished in 2.3 seconds (files took 0.11962 seconds to load)
18 examples, 0 failures

Randomized with seed 9279
➜  rspec-core git:(stop-rescuing-all-exceptions) bin/rspec --seed 33805
Run options:
  include {:focus=>true}
  exclude {:ruby=>#<Proc:./spec/spec_helper.rb:106>}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 33805
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................*.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) RSpec::Core::Metadata for an example points :example_group to the same hash object as other examples in the same group
     # Cannot maintain this and provide full `:example_group` backwards compatibility (see GH #1490):(
     Failure/Error: expect(b[:description]).to eq("new description")

       expected: "new description"
            got: "group"

       (compared using ==)
     # ./spec/rspec/core/metadata_spec.rb:138:in `block (3 levels) in <module:Core>'
     # ./spec/support/sandboxing.rb:14:in `block (3 levels) in <top (required)>'
     # ./spec/support/sandboxing.rb:7:in `block (2 levels) in <top (required)>'

Finished in 8.28 seconds (files took 0.7278 seconds to load)
1399 examples, 0 failures, 1 pending

Randomized with seed 33805

....................................................................................................................................................................................................................................................................................................................................................................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) RSpec::Core::Metadata for an example points :example_group to the same hash object as other examples in the same group
     # Cannot maintain this and provide full `:example_group` backwards compatibility (see GH #1490):(
     Failure/Error: expect(b[:description]).to eq("new description")

       expected: "new description"
            got: "group"

       (compared using ==)
     # ./spec/rspec/core/metadata_spec.rb:138:in `block (3 levels) in <module:Core>'
     # ./spec/support/sandboxing.rb:14:in `block (3 levels) in <top (required)>'
     # ./spec/support/sandboxing.rb:7:in `block (2 levels) in <top (required)>'

Failures:

  1) When an example forks and exits it the subprocess prints the results only once
     Failure/Error: expect(finished_lines.count).to eq(1)

       expected: 1
            got: 2

       (compared using ==)
     # ./spec/integration/subprocess_exit_spec.rb:21:in `block (3 levels) in <top (required)>'
     # ./bundle/ruby/2.1.0/gems/aruba-0.6.2/lib/aruba/api.rb:46:in `chdir'
     # ./bundle/ruby/2.1.0/gems/aruba-0.6.2/lib/aruba/api.rb:46:in `in_current_dir'
     # ./spec/integration/subprocess_exit_spec.rb:19:in `block (2 levels) in <top (required)>'
     # ./spec/support/sandboxing.rb:14:in `block (3 levels) in <top (required)>'
     # ./spec/support/sandboxing.rb:7:in `block (2 levels) in <top (required)>'

Finished in 11.92 seconds (files took 0.7278 seconds to load)
1803 examples, 1 failure, 1 pending

Failed examples:

rspec ./spec/integration/subprocess_exit_spec.rb:7 # When an example forks and exits it the subprocess prints the results only once

Randomized with seed 33805

I'm a bit at a loss for what's causing this. Anyone from @rspec/rspec got any ideas?

Merge request reports