[Python-checkins] cpython (2.7): #17065: Use process-unique key for winreg test.

r.david.murray python-checkins at python.org
Sun Apr 21 16:14:51 CEST 2013


http://hg.python.org/cpython/rev/c0cb78bedc2b
changeset:   83482:c0cb78bedc2b
branch:      2.7
parent:      83471:0c308d65d7bc
user:        R David Murray <rdmurray at bitdance.com>
date:        Sun Apr 21 10:13:43 2013 -0400
summary:
  #17065: Use process-unique key for winreg test.

Patch by Jeremy Kloth.

files:
  Lib/test/test_winreg.py |  7 +++++--
  Misc/NEWS               |  6 ++++++
  2 files changed, 11 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -28,9 +28,12 @@
 # tests are only valid up until 6.1
 HAS_REFLECTION = True if WIN_VER < (6, 1) else False
 
-test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me"
+# Use a per-process key to prevent concurrent test runs (buildbot!) from
+# stomping on each other.
+test_key_base = "Python Test Key [%d] - Delete Me" % (os.getpid(),)
+test_key_name = "SOFTWARE\\" + test_key_base
 # On OS'es that support reflection we should test with a reflected key
-test_reflect_key_name = "SOFTWARE\\Classes\\Python Test Key - Delete Me"
+test_reflect_key_name = "SOFTWARE\\Classes\\" + test_key_base
 
 test_data = [
     ("Int Value",     45,                                      REG_DWORD),
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -56,6 +56,12 @@
 - Issue #17526: fix an IndexError raised while passing code without filename to
   inspect.findsource().  Initial patch by Tyler Doyle.
 
+Tests
+-----
+
+- Issue #17065: Use process-unique key for winreg tests to avoid failures if
+  test is run multiple times in parallel (eg: on a buildbot host).
+
 IDLE
 ----
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list