ruby-changes:26355
From: nobu <ko1@a...>
Date: Sat, 15 Dec 2012 16:32:56 +0900 (JST)
Subject: [ruby-changes:26355] nobu:r38406 (trunk): test_gem_remote_fetcher.rb: restore environment variables
nobu 2012-12-15 16:29:43 +0900 (Sat, 15 Dec 2012) New Revision: 38406 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38406 Log: test_gem_remote_fetcher.rb: restore environment variables * test/rubygems/test_gem_remote_fetcher.rb (setup, teardown): always restore environment variables fo http proxy, to get rid of sporadic warnings from URI::Generic#find_proxy. Modified files: trunk/test/rubygems/test_gem_remote_fetcher.rb Index: test/rubygems/test_gem_remote_fetcher.rb =================================================================== --- test/rubygems/test_gem_remote_fetcher.rb (revision 38405) +++ test/rubygems/test_gem_remote_fetcher.rb (revision 38406) @@ -78,18 +78,14 @@ gems: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L78 DIR = File.expand_path(File.dirname(__FILE__)) def setup + @proxies = %w[http_proxy HTTP_PROXY http_proxy_user HTTP_PROXY_USER http_proxy_pass HTTP_PROXY_PASS no_proxy NO_PROXY] + @old_proxies = @proxies.map {|k| ENV[k] } + @proxies.each {|k| ENV[k] = nil } + super self.class.start_servers self.class.enable_yaml = true self.class.enable_zip = false - ENV.delete 'http_proxy' - ENV.delete 'HTTP_PROXY' - ENV.delete 'http_proxy_user' - ENV.delete 'HTTP_PROXY_USER' - ENV.delete 'http_proxy_pass' - ENV.delete 'HTTP_PROXY_PASS' - ENV.delete 'no_proxy' - ENV.delete 'NO_PROXY' base_server_uri = "http://localhost:#{SERVER_PORT}" @proxy_uri = "http://localhost:#{PROXY_PORT}" @@ -114,6 +110,7 @@ gems: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L110 def teardown super Gem.configuration[:http_proxy] = nil + @proxies.each_with_index {|k, i| ENV[k] = @old_proxies[i] } end def test_self_fetcher @@ -571,21 +568,12 @@ gems: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_remote_fetcher.rb#L568 end def test_get_proxy_from_env_empty - orig_env_HTTP_PROXY = ENV['HTTP_PROXY'] - orig_env_http_proxy = ENV['http_proxy'] - ENV['HTTP_PROXY'] = '' ENV.delete 'http_proxy' fetcher = Gem::RemoteFetcher.new nil assert_equal nil, fetcher.send(:get_proxy_from_env) - - ensure - orig_env_HTTP_PROXY.nil? ? ENV.delete('HTTP_PROXY') : - ENV['HTTP_PROXY'] = orig_env_HTTP_PROXY - orig_env_http_proxy.nil? ? ENV.delete('http_proxy') : - ENV['http_proxy'] = orig_env_http_proxy end def test_implicit_no_proxy -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/