Index: Lib/test/test_subprocess.py =================================================================== --- Lib/test/test_subprocess.py (revision 83977) +++ Lib/test/test_subprocess.py (working copy) @@ -23,6 +23,7 @@ if mswindows: SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), ' 'os.O_BINARY);') + import winreg else: SETBINARY = '' @@ -1087,6 +1088,20 @@ self.assertEqual([(256, 999), (666,), (666,)], record_calls) +if mswindows: + def check_file_assoc(test): + ok = False + try: + key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, + (r"SOFTWARE\Microsoft\Windows\CurrentVersion" + r"\Explorer\FileExts\.py\UserChoice")) + val = winreg.QueryValue(key, "Progid")[0] + if os.path.basename(val).lower() in ("python.exe", "python_d.exe"): + ok = True + finally: + msg = "Incompatible file association" + return test if ok else unittest.skip(msg)(test) + @unittest.skipUnless(mswindows, "Windows-specific tests") class CommandsWithSpaces (BaseTestCase): @@ -1111,10 +1126,12 @@ "2 [%r, 'ab cd']" % self.fname ) + @check_file_assoc def test_shell_string_with_spaces(self): # call() function with string argument with spaces on Windows self.with_spaces('"%s" "%s"' % (self.fname, "ab cd"), shell=1) + @check_file_assoc def test_shell_sequence_with_spaces(self): # call() function with sequence argument with spaces on Windows self.with_spaces([self.fname, "ab cd"], shell=1)