summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-07-13 20:46:41 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-07-13 20:46:41 (GMT)
commit2bb3021837351861369cdae15c241d67d2e914ba (patch)
treefaddb901073b0ba3862c0876d7e8fcbdb1e24195
parent924ae1b040f65fe486327e1efda8615932aeeff7 (diff)
downloadcpython-2bb3021837351861369cdae15c241d67d2e914ba.zip
cpython-2bb3021837351861369cdae15c241d67d2e914ba.tar.gz
cpython-2bb3021837351861369cdae15c241d67d2e914ba.tar.bz2
Try other approach to fix issue #15334.
-rw-r--r--Lib/test/test_winreg.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 6f31a55..55163c9 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -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