From 1c0a3a78297b29ba24da0cca36132387ce21ba35 Mon Sep 17 00:00:00 2001 From: Arie van Deursen Date: Mon, 26 Dec 2022 14:26:23 +0100 Subject: [PATCH] Only test thumbnails if they're enabled in the settings --- bookwyrm/tests/models/test_book_model.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bookwyrm/tests/models/test_book_model.py b/bookwyrm/tests/models/test_book_model.py index 5a2a6c3b6..ea73ab442 100644 --- a/bookwyrm/tests/models/test_book_model.py +++ b/bookwyrm/tests/models/test_book_model.py @@ -2,6 +2,8 @@ from io import BytesIO import pathlib +import pytest + from dateutil.parser import parse from PIL import Image from django.core.files.base import ContentFile @@ -10,7 +12,7 @@ from django.utils import timezone from bookwyrm import models, settings from bookwyrm.models.book import isbn_10_to_13, isbn_13_to_10 - +from bookwyrm.settings import ENABLE_THUMBNAIL_GENERATION class Book(TestCase): """not too much going on in the books model but here we are""" @@ -101,6 +103,10 @@ class Book(TestCase): self.first_edition.save() self.assertEqual(self.first_edition.edition_rank, 1) + @pytest.mark.skipif( + not ENABLE_THUMBNAIL_GENERATION, + reason="Thumbnail generation disabled in settings" + ) def test_thumbnail_fields(self): """Just hit them""" image_file = pathlib.Path(__file__).parent.joinpath(