Browse code

Don't mask away exceptions when testing.

Jose Fonseca authored on 15/11/2016 15:59:07
Showing 1 changed files

  • test.py index 71a3702..2101289 100755
... ...
@@ -97,25 +97,28 @@ class TestDotWidget(DotWidget):
97 97
 
98 98
 
99 99
 def main():
100
+    status = 0
100 101
     for arg in sys.argv[1:]:
101 102
         sys.stdout.write(arg + '\n')
102 103
         sys.stdout.flush()
103 104
         name, ext = os.path.splitext(os.path.basename(arg))
104
-        dotcode = open(arg, 'rb').read()
105 105
         widget = TestDotWidget(name)
106 106
         window = DotWindow(widget)
107 107
         window.connect('delete-event', Gtk.main_quit)
108 108
         try:
109
-            window.set_dotcode(dotcode)
110
-        except:
111
-            exc_info = sys.exc_info()
112
-            traceback.print_exception(*exc_info)
113
-            continue
114
-        try:
115
-            window.show()
116
-            Gtk.main()
109
+            try:
110
+                dotcode = open(arg, 'rb').read()
111
+                window.set_dotcode(dotcode)
112
+            except:
113
+                exc_info = sys.exc_info()
114
+                traceback.print_exception(*exc_info)
115
+                status = 1
116
+            else:
117
+                window.show()
118
+                Gtk.main()
117 119
         finally:
118 120
             window.destroy()
121
+    sys.exit(status)
119 122
 
120 123
 
121 124
 if __name__ == '__main__':