From f60887e70ac8f2b24637b4710f5cb9a18acef6aa Mon Sep 17 00:00:00 2001
From: Tristan Gingold <tgingold@free.fr>
Date: Sat, 26 Dec 2020 07:12:51 +0100
Subject: testsuite/python/units01: install error handler

---
 testsuite/python/units01/show_ports.py | 2 ++
 testsuite/python/units01/show_units.py | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/testsuite/python/units01/show_ports.py b/testsuite/python/units01/show_ports.py
index 0076e4779..31c680817 100644
--- a/testsuite/python/units01/show_ports.py
+++ b/testsuite/python/units01/show_ports.py
@@ -8,6 +8,7 @@ from libghdl.thin import files_map
 from libghdl.thin.vhdl import nodes
 from libghdl.thin.vhdl import sem_lib
 from libghdl.thin.vhdl import pyutils
+from libghdl.thin import errorout_console
 
 
 def get_identifier_ptr(n):
@@ -98,6 +99,7 @@ def list_units(filename):
 
 if __name__ == "__main__":
     # Initialization: set options and then load libaries
+    errorout_console.Install_Handler()
     libghdl.set_option(b"--std=08")
     libghdl.analyze_init()
 
diff --git a/testsuite/python/units01/show_units.py b/testsuite/python/units01/show_units.py
index 56ab8adee..9207bde8c 100755
--- a/testsuite/python/units01/show_units.py
+++ b/testsuite/python/units01/show_units.py
@@ -4,11 +4,16 @@ from libghdl.thin import name_table
 from libghdl.thin import files_map
 from libghdl.thin.vhdl import nodes
 from libghdl.thin.vhdl import sem_lib
+from libghdl.thin import errorout_console
 
 
 def init():
     """Initialization: set options and then load libaries"""
+    # Print error messages on the console
+    errorout_console.Install_Handler()
+    # Set options.  This must be done before analyze_init()
     libghdl.set_option(b"--std=08")
+    # Finish initialization. This will load the standard package
     libghdl.analyze_init()
 
 
-- 
cgit v1.2.3