Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rwrite test-case for rubygems_hook without Gem::TestCase #815

Merged
merged 4 commits into from
Jun 18, 2021

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented Jun 18, 2021

No description provided.

@hsbt hsbt force-pushed the fix-rubygems-hook-testcase branch from 9743b27 to f8d1087 Compare June 18, 2021 03:44
Copy link
Member

@nobu nobu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppress outputs from the hook.

test/rdoc/test_rdoc_rubygems_hook.rb Show resolved Hide resolved
test/rdoc/test_rdoc_rubygems_hook.rb Show resolved Hide resolved
@hsbt hsbt marked this pull request as ready for review June 18, 2021 06:36
@hsbt hsbt force-pushed the fix-rubygems-hook-testcase branch from d5ed014 to 8460a36 Compare June 18, 2021 06:37

@hook = RDoc::RubygemsHook.new @a

begin
RDoc::RubygemsHook.load_rdoc
rescue Gem::DocumentError => e
skip e.message
pend e.message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting change, would pend be interchangeable with omit here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was late to the conversation, sorry about that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what differences pend and omit.

@kou Do you have any opinion about them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit is suitable for this case.
omit for omitting the test because the test isn't needed to be ran.
pend for omitting the test temporary. The test should be fixed later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, pend is used with a block.

If the given block is failed, it's expected for pend. The test is marked as "pending".

If the given block is not failed, it's unexpected for pend. The test is marked as "failed".

require "test-unit"

class T < Test::Unit::TestCase
  test "pend: pass" do
    pend "XXX" do
      assert_equal("AAA", "AAA")
    end
  end

  test "pend: failure" do
    pend "XXX" do
      assert_equal("AAA", "BBB")
    end
  end
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kou Thanks! I understood them.

@hsbt hsbt merged commit 59e4cc0 into master Jun 18, 2021
@hsbt hsbt deleted the fix-rubygems-hook-testcase branch June 18, 2021 08:04
nobu added a commit to nobu/rdoc that referenced this pull request Jun 28, 2021
These conditions are not temporary, rather platform dependent.

ruby#815 (comment)
@nobu nobu mentioned this pull request Jun 28, 2021
nobu added a commit to nobu/ruby that referenced this pull request Jul 5, 2021
These conditions are not temporary, rather platform dependent.

ruby/rdoc#815 (comment)

ruby/rdoc@92545fa250
matzbot pushed a commit to ruby/ruby that referenced this pull request Feb 13, 2022
…83aa8394fc26e341666db66938b1d6fc2cbb8e,f2e39e5fed498b51ae914ed42ec51ae578330583,6aaa1c4d09249baae93d5bb7fba585be420c4fee,923b3652247aa17ac99dc45cb1cd0654fa08d976,950c7a12efa19d73bed10d377368a50664cae32c,69ce9e4187589335124077029496ee293d4e9189,ddb87396349fa4699153d5c4c7569c2e0186adfc,09e7a0c4a4fba18e3308e4f8cb4b8b5b52b41d20,298d65b1e4f3019af7fc9b905390b56736f5fd0e,2f3edf28f3a251bac2cf3b47b46b372faac71e8e:

	[ruby/rdoc] Follow-up rubygems

	Use test-unit assertions instead of minitest.

	ruby/rdoc@d6a6209d7f
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 18 ++++++++++++------
	 1 file changed, 12 insertions(+), 6 deletions(-)

	[ruby/rdoc] Add an alias for test-unit with older versions of
	 RubyGems

	ruby/rdoc@b8d68fdd87
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 3 +++
	 1 file changed, 3 insertions(+)

	[ruby/rdoc] Rwrite test-case for rubygems_hook without Gem::TestCase

	ruby/rdoc@f8d1087ce5
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 38 +++++++++++++++++++-----------------
	 1 file changed, 20 insertions(+), 18 deletions(-)

	[ruby/rdoc] Update test/rdoc/test_rdoc_rubygems_hook.rb

	ruby/rdoc@fb264c4cc4

	Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 4 ++++
	 1 file changed, 4 insertions(+)

	[ruby/rdoc] Use pend instead of skip

	ruby/rdoc@8460a36d84
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 10 +++++-----
	 1 file changed, 5 insertions(+), 5 deletions(-)

	Close UserInteraction for tests to fix leaked file descriptors

	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 2 ++
	 1 file changed, 2 insertions(+)

	Make temporary directory under the regular location

	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 6 ++----
	 1 file changed, 2 insertions(+), 4 deletions(-)

	Clear default configurations

	Remove environment variables which can affect the default
	configurations.
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 13 +++++++++++++
	 1 file changed, 13 insertions(+)

	Clear rdoc options in the global rubygems configuration

	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 2 ++
	 1 file changed, 2 insertions(+)

	Dispose the global rubygems configuration wholely

	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 2 +-
	 1 file changed, 1 insertion(+), 1 deletion(-)

	Discard RDOCOPT environment variable to make tests stable

	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 1 +
	 1 file changed, 1 insertion(+)

	[ruby/rdoc] Prefer omit to pend

	These conditions are not temporary, rather platform dependent.

	ruby/rdoc#815 (comment)

	ruby/rdoc@92545fa250
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 10 +++++-----
	 1 file changed, 5 insertions(+), 5 deletions(-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants