Skip to content

Add option to silence deprecation warnings when running the tests #2948

@stefannibrasil

Description

@stefannibrasil

We have recently introduced an internal deprecator for faker. See #2858 and #2919 for more details.

We'd like to have the option to skip printing out the deprecation warnings when running the tests. Currently, we get a long test output due to them.

Ruby's Deprecate gem has the option to wrap a test assertion in a skip_during block, intended to be used in the test suite only:

class TestSomething < Gem::Testcase
  def test_some_thing_with_deprecations
    Gem::Deprecate.skip_during do
      actual_stdout, actual_stderr = capture_output do
        Gem.something_deprecated
      end
      assert_empty actual_stdout
      assert_equal(expected, actual_stderr)
    end
  end
end

It would be nice if we could have a similar option for our custom deprecator so our test output is not filled with those deprecation messages while they are being removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions