@@ -93,6 +93,11 @@ def throttle_compile():
9393with open (BOARDS_PATH ) as f :
9494 BOARDS_DB = simplejson .loads (f .read ())
9595
96+ # Display progress
97+ def display_progress (status ):
98+ sys .stdout .write (status )
99+ sys .stdout .flush ()
100+
96101def read_last_log (compile_type ):
97102 logs = os .listdir (get_path ('logs' ))
98103 logs_re = re .compile (r'.+cb_compile_tester.+' )
@@ -641,27 +646,36 @@ def comment_compile_libraries_examples(self, sketches, library_examples_dic={},
641646 library_re = re .compile (r'^.+/library/.+$' )
642647
643648 for url in urls_to_visit :
644-
645649 if library_re .match (url ):
646650 library = url .split ('/' )[- 1 ]
647- for key , value in library_examples_dic .iteritems ():
648- if (key == library and len (value ) == 0 ):
651+ try :
652+ # Comment libraries without examples
653+ if len (library_examples_dic [library ]) == 0 :
649654 if logfile is None or not self .run_full_compile_tests :
650655 toc = time .time ()
651656 continue
652657
653658 # Update Disqus comments.
654659 current_date = strftime ('%Y-%m-%d' , log_time )
655660 if comment and compile_type in ['library' , 'target_library' ]:
656- library = key
657- examples = False
661+ self .open (url )
662+ self .get_element (By .CSS_SELECTOR , '#mycontainer h1' )
663+ examples = False
658664 log_entry = disqus_wrapper .handle_library_comment (library , current_date , log_entry , examples )
659665 self .create_log (log_file , log_entry , compile_type )
660- toc = time .time ()
661- if (toc - tic ) >= SAUCELABS_TIMEOUT_SECONDS :
662- print '\n Stopping tests to avoid saucelabs timeout'
663- print 'Test duration:' , int (toc - tic ), 'sec'
664- return
666+
667+ test_status = '.'
668+ if not log_entry [url ]['comment' ]:
669+ test_status = 'F'
670+ display_progress (test_status )
671+ except Exception as error :
672+ print error
673+
674+ toc = time .time ()
675+ if (toc - tic ) >= SAUCELABS_TIMEOUT_SECONDS :
676+ print '\n Stopping tests to avoid saucelabs timeout'
677+ print 'Test duration:' , int (toc - tic ), 'sec'
678+ return
665679 else :
666680 sketch = url
667681 # Read the boards map in case current sketch/example requires a special board configuration.
@@ -726,9 +740,7 @@ def comment_compile_libraries_examples(self, sketches, library_examples_dic={},
726740
727741 self .create_log (log_file , log_entry , compile_type )
728742
729- # Display progress
730- sys .stdout .write (test_status )
731- sys .stdout .flush ()
743+ display_progress (test_status )
732744
733745 toc = time .time ()
734746 if (toc - tic ) >= SAUCELABS_TIMEOUT_SECONDS :
@@ -835,9 +847,7 @@ def compile_sketches(self, sketches, iframe=False, project_view=False, logfile=N
835847
836848 self .create_log (log_file , log_entry , compile_type )
837849
838- # Display progress
839- sys .stdout .write (test_status )
840- sys .stdout .flush ()
850+ display_progress (test_status )
841851
842852 toc = time .time ()
843853 if toc - tic >= SAUCELABS_TIMEOUT_SECONDS :
0 commit comments