]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-30448: Fix support.SuppressCrashReport on macOS (#2515)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 30 Jun 2017 23:01:28 +0000 (01:01 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2017 23:01:28 +0000 (01:01 +0200)
Add missing "import subprocess".

Lib/test/support/__init__.py

index c024b0773c06869b5712041f320e9dec96e00745..ef474e00b68cc3b6c174cc07eb98625b745d8d6e 100644 (file)
@@ -1916,13 +1916,13 @@ class SuppressCrashReport:
                 #
                 # This assumes that this context manager is used in tests
                 # that might trigger the next manager.
+                import subprocess
                 cmd = ['/usr/bin/defaults', 'read',
                        'com.apple.CrashReporter', 'DialogType']
                 proc = subprocess.Popen(cmd,
                                         stdout=subprocess.PIPE,
                                         stderr=subprocess.PIPE)
-                with proc:
-                    stdout = proc.communicate()[0]
+                stdout = proc.communicate()[0]
                 if stdout.strip() == b'developer':
                     sys.stdout.write("this test triggers the Crash Reporter, "
                                      "that is intentional")