[前][次][番号順一覧][スレッド一覧]

ruby-changes:71174

From: nagachika <ko1@a...>
Date: Sun, 13 Feb 2022 16:09:28 +0900 (JST)
Subject: [ruby-changes:71174] 6c70a32918 (ruby_3_0): merge revision(s) f18a0b7654d471101b207e7fe553e12a25398e45,77e1b477297a48e285d34b21e8d30ab4b46bf90c,c483aa8394fc26e341666db66938b1d6fc2cbb8e,f2e39e5fed498b51ae914ed42ec51ae578330583,6aaa1c4d09249baae93d5bb7fba585be420c4fee,923b3652247aa17ac99dc45cb1cd0654fa08d976,950c7a12efa19d73bed10d377368a50664cae32c,69ce9e4187589335124077029496ee293d4e9189,ddb87396349fa4699153d5c4c7569c2e0186adfc,09e7a0c4a4fba18e3308e4f8cb4b8b5b52b41d20,298d65b1e4f3019af7fc9b905390b56736f5fd0e,2f3edf28f3a251bac2cf3b47b46b372faac71e8e:

https://git.ruby-lang.org/ruby.git/commit/?id=6c70a32918

From 6c70a32918738a183d65fcca6bb2b4010ed4536a Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Sun, 13 Feb 2022 16:05:27 +0900
Subject: merge revision(s)
 f18a0b7654d471101b207e7fe553e12a25398e45,77e1b477297a48e285d34b21e8d30ab4b46bf90c,c483aa8394fc26e341666db66938b1d6fc2cbb8e,f2e39e5fed498b51ae914ed42ec51ae578330583,6aaa1c4d09249baae93d5bb7fba585be420c4fee,923b3652247aa17ac99dc45cb1cd0654fa08d976,950c7a12efa19d73bed10d377368a50664cae32c,69ce9e4187589335124077029496ee293d4e9189,ddb87396349fa4699153d5c4c7569c2e0186adfc,09e7a0c4a4fba18e3308e4f8cb4b8b5b52b41d20,298d65b1e4f3019af7fc9b905390b56736f5fd0e,2f3edf28f3a251bac2cf3b47b46b372faac71e8e:

	[ruby/rdoc] Follow-up rubygems

	Use test-unit assertions instead of minitest.

	https://github.com/ruby/rdoc/commit/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

	https://github.com/ruby/rdoc/commit/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

	https://github.com/ruby/rdoc/commit/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

	https://github.com/ruby/rdoc/commit/fb264c4cc4

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

	[ruby/rdoc] Use pend instead of skip

	https://github.com/ruby/rdoc/commit/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.

	https://github.com/ruby/rdoc/pull/815#discussion_r654660411

	https://github.com/ruby/rdoc/commit/92545fa250
	---
	 test/rdoc/test_rdoc_rubygems_hook.rb | 10 +++++-----
	 1 file changed, 5 insertions(+), 5 deletions(-)
---
 test/rdoc/test_rdoc_rubygems_hook.rb | 77 +++++++++++++++++++++++++-----------
 version.h                            |  2 +-
 2 files changed, 55 insertions(+), 24 deletions(-)

diff --git a/test/rdoc/test_rdoc_rubygems_hook.rb b/test/rdoc/test_rdoc_rubygems_hook.rb
index ab7d95cac2..04f84d4bcc 100644
--- a/test/rdoc/test_rdoc_rubygems_hook.rb
+++ b/test/rdoc/test_rdoc_rubygems_hook.rb
@@ -1,31 +1,62 @@ https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rubygems_hook.rb#L1
 # frozen_string_literal: true
-require 'rubygems/test_case'
+require "rubygems"
+require "fileutils"
+require "tmpdir"
 require 'rdoc/rubygems_hook'
+require "test/unit"
 
-class TestRDocRubygemsHook < Gem::TestCase
-
+class TestRDocRubygemsHook < Test::Unit::TestCase
   def setup
-    super
-
-    @a = util_spec 'a', 2 do |s|
+    @a = Gem::Specification.new do |s|
+      s.platform    = Gem::Platform::RUBY
+      s.name        = "a"
+      s.version     = 2
       s.rdoc_options = %w[--main MyTitle]
       s.extra_rdoc_files = %w[README]
     end
-
-    write_file File.join(@tempdir, 'lib', 'a.rb')
-    write_file File.join(@tempdir, 'README')
-
-    install_gem @a
+    @tempdir = File.realpath(Dir.mktmpdir("test_rubygems_hook_"))
+
+    @orig_envs = %w[
+      GEM_VENDOR
+      GEMRC
+      XDG_CACHE_HOME
+      XDG_CONFIG_HOME
+      XDG_DATA_HOME
+      SOURCE_DATE_EPOCH
+      BUNDLER_VERSION
+      HOME
+      RDOCOPT
+    ].map {|e| [e, ENV.delete(e)]}.to_h
+    ENV["HOME"] = @tempdir
+
+    Gem.configuration = nil
+
+    @a.instance_variable_set(:@doc_dir, File.join(@tempdir, "doc"))
+    @a.instance_variable_set(:@gem_dir, File.join(@tempdir, "a-2"))
+    @a.instance_variable_set(:@full_gem_path, File.join(@tempdir, "a-2"))
+    @a.loaded_from = File.join(@tempdir, 'a-2', 'a-2.gemspec')
+
+    FileUtils.mkdir_p File.join(@tempdir, 'a-2', 'lib')
+    FileUtils.touch   File.join(@tempdir, 'a-2', 'lib', 'a.rb')
+    FileUtils.touch   File.join(@tempdir, 'a-2', 'README')
 
     @hook = RDoc::RubygemsHook.new @a
 
     begin
       RDoc::RubygemsHook.load_rdoc
     rescue Gem::DocumentError => e
-      skip e.message
+      omit e.message
     end
+    @old_ui = Gem::DefaultUserInteraction.ui
+    Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
+  end
 
-    Gem.configuration[:rdoc] = nil
+  def teardown
+    ui = Gem::DefaultUserInteraction.ui
+    Gem::DefaultUserInteraction.ui = @old_ui
+    FileUtils.rm_rf @tempdir
+    ui.close
+    ENV.update(@orig_envs)
   end
 
   def test_initialize
@@ -165,8 +196,8 @@ class TestRDocRubygemsHook < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rubygems_hook.rb#L196
 
     @hook.generate
 
-    refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
-    assert_path_exists File.join(@a.doc_dir('ri'),   'cache.ri')
+    assert_path_not_exist File.join(@a.doc_dir('rdoc'), 'index.html')
+    assert_path_exist File.join(@a.doc_dir('ri'),   'cache.ri')
   end
 
   def test_generate_no_overwrite
@@ -176,8 +207,8 @@ class TestRDocRubygemsHook < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rubygems_hook.rb#L207
 
     @hook.generate
 
-    refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
-    refute_path_exists File.join(@a.doc_dir('ri'),   'cache.ri')
+    assert_path_not_exist File.join(@a.doc_dir('rdoc'), 'index.html')
+    assert_path_not_exist File.join(@a.doc_dir('ri'),   'cache.ri')
   end
 
   def test_new_rdoc
@@ -201,12 +232,12 @@ class TestRDocRubygemsHook < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rubygems_hook.rb#L232
     refute @hook.rdoc_installed?
     refute @hook.ri_installed?
 
-    assert_path_exists @a.doc_dir
+    assert_path_exist @a.doc_dir
   end
 
   def test_remove_unwritable
-    skip 'chmod not supported' if Gem.win_platform?
-    skip "assumes that euid is not root" if Process.euid == 0
+    omit 'chmod not supported' if Gem.win_platform?
+    omit "assumes that euid is not root" if Process.euid == 0
 
     FileUtils.mkdir_p @a.base_dir
     FileUtils.chmod 0, @a.base_dir
@@ -231,12 +262,12 @@ class TestRDocRubygemsHook < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rubygems_hook.rb#L262
   def test_setup
     @hook.setup
 
-    assert_path_exists @a.doc_dir
+    assert_path_exist @a.doc_dir
   end
 
   def test_setup_unwritable
-    skip 'chmod not supported' if Gem.win_platform?
-    skip "assumes that euid is not root" if Process.euid == 0
+    omit 'chmod not supported' if Gem.win_platform?
+    omit "assumes that euid is not root" if Process.euid == 0
 
     FileUtils.mkdir_p @a.doc_dir
     FileUtils.chmod 0, @a.doc_dir
diff --git a/version.h b/version.h
index a34639b6ea..3f82a9480f 100644
--- a/version.h
+++ b/version.h
@@ -12,7 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L12
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 4
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 172
+#define RUBY_PATCHLEVEL 173
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 2
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]