diff --git a/qiskit/visualization/pass_manager_visualization.py b/qiskit/visualization/pass_manager_visualization.py
index <HASH>..<HASH> 100644
--- a/qiskit/visualization/pass_manager_visualization.py
+++ b/qiskit/visualization/pass_manager_visualization.py
@@ -23,9 +23,14 @@ DEFAULT_STYLE = {AnalysisPass: 'red',
 
 try:
     import subprocess
-    print(subprocess.check_output(['dot', '-V']))
-    HAS_GRAPHVIZ = True
-except FileNotFoundError:
+    _PROC = subprocess.Popen(['dot', '-V'], stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
+    _PROC.communicate()
+    if _PROC.returncode != 0:
+        HAS_GRAPHVIZ = False
+    else:
+        HAS_GRAPHVIZ = True
+except Exception:  # pylint: disable=broad-except
     # this is raised when the dot command cannot be found, which means GraphViz
     # isn't installed
     HAS_GRAPHVIZ = False
Fix graphviz check in pass manager visualization (#<I>)

This commit fixes the graphviz check in the pass manager visualization

added recently in #<I>. The check was added to determine if the dot

command was in the default PATH by trying to subprocess out and run

'dot -V' however the way in which subprocess was called results in both

the dot version string and a blank line being printed if graphviz is

actually installed. This happens on import time which we definitely

don't want to do (and breaks test discovery in stestr).