]> granicus.if.org Git - python/commitdiff
Workaround for issue 4047: in some configurations of
authorRonald Oussoren <ronaldoussoren@mac.com>
Fri, 23 Jul 2010 09:50:05 +0000 (09:50 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Fri, 23 Jul 2010 09:50:05 +0000 (09:50 +0000)
the Crash Reporter on OSX test_subprocess will trigger
the reporter.

This patch prints a warning when the Crash Reporter will
get triggered intentionally, which should avoid confusing
people.

Lib/test/test_subprocess.py

index 0f7d26c5d256cdff3831093bce4dee170919fe04..e6ba8cb1eac8d9770fdbe3fcdba5926b1483335e 100644 (file)
@@ -559,6 +559,21 @@ class _SuppressCoreFiles(object):
         except (ImportError, ValueError, resource.error):
             pass
 
+        if sys.platform == 'darwin':
+            # Check if the 'Crash Reporter' on OSX was configured
+            # in 'Developer' mode and warn that it will get triggered
+            # when it is.
+            #
+            # This assumes that this context manager is used in tests
+            # that might trigger the next manager.
+            value = subprocess.Popen(['/usr/bin/defaults', 'read',
+                    'com.apple.CrashReporter', 'DialogType'],
+                    stdout=subprocess.PIPE).communicate()[0]
+            if value.strip() == b'developer':
+                print("this tests triggers the Crash Reporter, "
+                      "that is intentional", end='')
+                sys.stdout.flush()
+
     def __exit__(self, *args):
         """Return core file behavior to default."""
         if self.old_limit is None: