mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
23 lines
473 B
Python
23 lines
473 B
Python
import pytest
|
|
import tempfile
|
|
from PIL import Image
|
|
|
|
from django.core.files import File as DjangoFile
|
|
|
|
pytest_plugins = [
|
|
"users.tests.fixtures",
|
|
"versions.tests.fixtures",
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def temp_image_file():
|
|
image = Image.new("RGB", (100, 100))
|
|
|
|
tmp_file = tempfile.NamedTemporaryFile(suffix=".jpg")
|
|
image.save(tmp_file)
|
|
|
|
tmp_file.seek(0)
|
|
file_obj = DjangoFile(open(tmp_file.name, mode="rb"), name="tmp_file")
|
|
yield file_obj.seek(0)
|