]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Try other approach to fix issue #15334.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 13 Jul 2012 20:46:41 +0000 (22:46 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 13 Jul 2012 20:46:41 +0000 (22:46 +0200)
Lib/test/test_winreg.py

index 6f31a559bad703dfd74be32a8f1eccd636bd33d3..55163c98bff3e78a2b399162be777538de3712ed 100644 (file)
@@ -1,7 +1,7 @@
 # Test the windows specific win32reg module.
 # Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
 
-import os, sys
+import os, sys, errno
 import unittest
 from test import support
 threading = support.import_module("threading")
@@ -289,11 +289,16 @@ class LocalWinregTests(BaseWinregTests):
             DeleteKey(HKEY_CURRENT_USER, '\\'.join((test_key_name, name)))
             DeleteKey(HKEY_CURRENT_USER, test_key_name)
 
-    @unittest.skipUnless('PROMPT' in os.environ, "Requires interactive session")
     def test_dynamic_key(self):
         # Issue2810, when the value is dynamically generated, these
         # throw "WindowsError: More data is available" in 2.6 and 3.1
-        EnumValue(HKEY_PERFORMANCE_DATA, 0)
+        try:
+            EnumValue(HKEY_PERFORMANCE_DATA, 0)
+        except OSError as e:
+            if e.errno in (errno.EPERM, errno.EACCES):
+                self.skipTest("access denied to registry key "
+                              "(are you running in a non-interactive session?)")
+            raise
         QueryValueEx(HKEY_PERFORMANCE_DATA, "")
 
     # Reflection requires XP x64/Vista at a minimum. XP doesn't have this stuff