@@ -93,6 +93,11 @@ def throttle_compile():
93
93
with open (BOARDS_PATH ) as f :
94
94
BOARDS_DB = simplejson .loads (f .read ())
95
95
96
+ # Display progress
97
+ def display_progress (status ):
98
+ sys .stdout .write (status )
99
+ sys .stdout .flush ()
100
+
96
101
def read_last_log (compile_type ):
97
102
logs = os .listdir (get_path ('logs' ))
98
103
logs_re = re .compile (r'.+cb_compile_tester.+' )
@@ -545,7 +550,7 @@ def open_all_libraries_and_examples(self, url, logfile):
545
550
url_name = url .split ('/' )[- 1 ]
546
551
name = self .get_element (By .CSS_SELECTOR , '#mycontainer h1 small' ).text
547
552
name = re .sub ('[()]' , '' , name ).split ('.' )[0 ]
548
- if ( name != url_name ) :
553
+ if name != url_name :
549
554
print "Didn't open url: " , url
550
555
551
556
test_status = True
@@ -641,27 +646,36 @@ def comment_compile_libraries_examples(self, sketches, library_examples_dic={},
641
646
library_re = re .compile (r'^.+/library/.+$' )
642
647
643
648
for url in urls_to_visit :
644
-
645
649
if library_re .match (url ):
646
650
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 :
649
654
if logfile is None or not self .run_full_compile_tests :
650
655
toc = time .time ()
651
656
continue
652
657
653
658
# Update Disqus comments.
654
659
current_date = strftime ('%Y-%m-%d' , log_time )
655
660
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
658
664
log_entry = disqus_wrapper .handle_library_comment (library , current_date , log_entry , examples )
659
665
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
665
679
else :
666
680
sketch = url
667
681
# 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={},
726
740
727
741
self .create_log (log_file , log_entry , compile_type )
728
742
729
- # Display progress
730
- sys .stdout .write (test_status )
731
- sys .stdout .flush ()
743
+ display_progress (test_status )
732
744
733
745
toc = time .time ()
734
746
if (toc - tic ) >= SAUCELABS_TIMEOUT_SECONDS :
@@ -835,9 +847,7 @@ def compile_sketches(self, sketches, iframe=False, project_view=False, logfile=N
835
847
836
848
self .create_log (log_file , log_entry , compile_type )
837
849
838
- # Display progress
839
- sys .stdout .write (test_status )
840
- sys .stdout .flush ()
850
+ display_progress (test_status )
841
851
842
852
toc = time .time ()
843
853
if toc - tic >= SAUCELABS_TIMEOUT_SECONDS :
0 commit comments