Skip to content

Commit 3b2defe

Browse files
committed
Fixed comments in libraries withough examples.
Fixes duplicate comments made due to a different commment template used in such libraries.
1 parent 7ffdd9e commit 3b2defe

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

codebender_testing/disqus.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def handle_library_comment(self, library, domain, current_date, log, examples=Tr
127127
for thread in paginator:
128128

129129
# Check if library has already a comment.
130-
post_id, existing_message = self.get_posts(thread['id'], 'library')
130+
post_id, existing_message = self.get_posts(thread['id'], 'library', examples=examples)
131131

132132
# If library already has a comment, update it.
133133
if post_id and existing_message:
@@ -187,12 +187,14 @@ def handle_example_comment(self, url, results, current_date, log):
187187

188188
return log
189189

190-
def get_posts(self, thread_id, type):
190+
def get_posts(self, thread_id, type, examples=True):
191191
post_id = None
192192
raw_message = None
193193
type_regexp = re.compile(r'^This example was tested.+')
194-
if type == 'library':
194+
if type == 'library' and examples:
195195
type_regexp = re.compile(r'^This library and its examples were tested.+')
196+
elif type == 'library' and not examples:
197+
type_regexp = re.compile(r'^This library was tested.+')
196198
try:
197199
""" Returns a Paginator object that matches the desired criteria:
198200
`self.disqus.api.posts.list`: Returns a list of posts ordered by the date created.

codebender_testing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def comment_compile_libraries_examples(self, sketches, library_examples_dic={},
669669
self.get_element(By.CSS_SELECTOR, '#mycontainer h1')
670670
examples = False
671671
domain = library_match.group(1)
672-
log_entry = disqus_wrapper.handle_library_comment(library, domain, current_date, log_entry, examples)
672+
log_entry = disqus_wrapper.handle_library_comment(library, domain, current_date, log_entry, examples=examples)
673673
if url in log_entry and log_entry[url]['comment']:
674674
test_status = '.'
675675
self.create_log(log_file, log_entry, compile_type)

0 commit comments

Comments
 (0)