Skip to content

Commit 50a9628

Browse files
committed
Fxing tests
1 parent 7b980c2 commit 50a9628

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

image_preview_thumbnailer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def process_link(img_downloader, anchor_tag, url_match, config=PluginConfig()):
150150
tmp_thumb_filepath = img_downloader(url_match, config)
151151
if not tmp_thumb_filepath: # => means the downloader failed to retrieve the image in a "supported" case
152152
hostname = urlparse(anchor_tag['href']).netloc
153+
LOGGER.info(f"Downloader could not retrieve image: now creating {thumb_filename}.{hostname}.none")
153154
with open(config.fs_thumbs_dir(f'{thumb_filename}.{hostname}.none'), 'w', encoding='utf8'):
154155
pass
155156
return

test_image_preview_thumbnailer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</html>"""
1919

2020

21-
def setup():
21+
def setup_function():
2222
logging.root.setLevel(logging.DEBUG)
2323
LOGGER.disable_filter() # disabling LimitFilter log deduping from pelican.log.FatalLogger
2424
thumbs_dir = PluginConfig().fs_thumbs_dir()
@@ -37,10 +37,10 @@ def test_artstation():
3737

3838
@pytest.mark.integration
3939
def test_behance():
40-
url = 'https://www.behance.net/gallery/58149803/Character-design-vol-8'
40+
url = 'https://www.behance.net/gallery/26813509/everydays-may-2015'
4141
out_html = process_all_links_in_html(BLOG_PAGE_TEMPLATE.format(illustration_url=url))
42-
assert os.path.getsize("thumbnails/Character-design-vol-8.jpg") > 0
43-
assert 'src="thumbnails/Character-design-vol-8.jpg"' in out_html
42+
assert os.path.getsize("thumbnails/everydays-may-2015.jpg") > 0
43+
assert 'src="thumbnails/everydays-may-2015.jpg"' in out_html
4444

4545
@pytest.mark.integration
4646
def test_dafont():
@@ -60,7 +60,7 @@ def test_deviantart():
6060
def test_deviantart_mature_content():
6161
url = 'https://www.deviantart.com/eggboy122/art/Angel-maybe-697980132'
6262
out_html = process_all_links_in_html(BLOG_PAGE_TEMPLATE.format(illustration_url=url))
63-
assert os.path.getsize("thumbnails/Angel-maybe-697980132.none") == 0
63+
assert os.path.getsize("thumbnails/Angel-maybe-697980132.www.deviantart.com.none") == 0
6464
assert '<img' not in out_html
6565

6666
@pytest.mark.integration

0 commit comments

Comments
 (0)