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

ruby-changes:39644

From: nobu <ko1@a...>
Date: Sun, 30 Aug 2015 15:46:25 +0900 (JST)
Subject: [ruby-changes:39644] nobu:r51725 (trunk): test_win32ole_event.rb: skip 80041008

nobu	2015-08-30 15:46:16 +0900 (Sun, 30 Aug 2015)

  New Revision: 51725

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51725

  Log:
    test_win32ole_event.rb: skip 80041008
    
    * test/win32ole/test_win32ole_event.rb (exec_notification_query_async):
      skip error with OLE error code:80041008, which seems to occur when
      logging in as a non admistrator user.

  Modified files:
    trunk/test/win32ole/test_win32ole_event.rb
Index: test/win32ole/test_win32ole_event.rb
===================================================================
--- test/win32ole/test_win32ole_event.rb	(revision 51724)
+++ test/win32ole/test_win32ole_event.rb	(revision 51725)
@@ -91,7 +91,7 @@ if defined?(WIN32OLE_EVENT) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_event.rb#L91
       end
 
       def test_s_new_loop
-        @wmi.ExecNotificationQueryAsync(@sws, @sql)
+        exec_notification_query_async
         ev = WIN32OLE_EVENT.new(@sws)
         ev.on_event {|*args| default_handler(*args)}
         message_loop
@@ -104,7 +104,7 @@ if defined?(WIN32OLE_EVENT) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_event.rb#L104
       end
 
       def test_on_event
-        @wmi.ExecNotificationQueryAsync(@sws, @sql)
+        exec_notification_query_async
         ev = WIN32OLE_EVENT.new(@sws, 'ISWbemSinkEvents')
         ev.on_event {|*args| default_handler(*args)}
         message_loop
@@ -112,7 +112,7 @@ if defined?(WIN32OLE_EVENT) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_event.rb#L112
       end
 
       def test_on_event_symbol
-        @wmi.ExecNotificationQueryAsync(@sws, @sql)
+        exec_notification_query_async
         ev = WIN32OLE_EVENT.new(@sws)
         ev.on_event(:OnObjectReady) {|*args|
           handler1
@@ -121,6 +121,14 @@ if defined?(WIN32OLE_EVENT) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_event.rb#L121
         assert_equal("handler1", @event1)
       end
 
+      private
+      def exec_notification_query_async
+        @wmi.ExecNotificationQueryAsync(@sws, @sql)
+      rescue => e
+        # No administrator privilege?
+        skip if /OLE error code:80041008 in SWbemServicesEx/ =~ e.message
+        raise
+      end
     end
   end
 

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

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