File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ test_script:
139139 - if x%USE_PYTEST% == xyes py.test %PYTEST_ARGS%
140140 - if x%USE_PYTEST% == xno python tests.py %PYTEST_ARGS%
141141 # Generate a html for visual tests
142- - python visual_tests.py
142+ - python visual_tests.py --no-browser
143143 - pip install codecov
144144 - codecov -e PYTHON_VERSION PLATFORM
145145
@@ -180,7 +180,7 @@ artifacts:
180180on_finish :
181181
182182on_failure :
183- - python visual_tests.py
183+ - python visual_tests.py --no-browser
184184 - echo zipping images after a failure...
185185 - 7z a result_images.zip result_images\ |grep -v "Compressing"
186186 - appveyor PushArtifact result_images.zip
Original file line number Diff line number Diff line change 66# $ python visual_tests.py
77#
88
9+ import argparse
910import os
1011from collections import defaultdict
1112
4445linked_image_template = '<a href="{0}"><img src="{0}"></a>'
4546
4647
47- def run ():
48+ def run (show_browser = True ):
4849 """
4950 Build a website for visual comparison
5051 """
@@ -116,12 +117,21 @@ def run():
116117 with open (index , "w" ) as f :
117118 f .write (html )
118119
119- try :
120- import webbrowser
121- webbrowser .open (index )
122- except :
120+ show_message = not show_browser
121+ if show_browser :
122+ try :
123+ import webbrowser
124+ webbrowser .open (index )
125+ except :
126+ show_message = True
127+
128+ if show_message :
123129 print ("Open {} in a browser for a visual comparison." .format (index ))
124130
125131
126132if __name__ == '__main__' :
127- run ()
133+ parser = argparse .ArgumentParser ()
134+ parser .add_argument ('--no-browser' , action = 'store_true' ,
135+ help = "Don't show browser after creating index page." )
136+ args = parser .parse_args ()
137+ run (show_browser = not args .no_browser )
You can’t perform that action at this time.
0 commit comments