Path: blob/master/test/conftest.py
3055 views
import base641import os23import pytest45test_files_path = os.path.dirname(__file__) + "/test_files"6test_outputs_path = os.path.dirname(__file__) + "/test_outputs"789def pytest_configure(config):10# We don't want to fail on Py.test command line arguments being11# parsed by webui:12os.environ.setdefault("IGNORE_CMD_ARGS_ERRORS", "1")131415def file_to_base64(filename):16with open(filename, "rb") as file:17data = file.read()1819base64_str = str(base64.b64encode(data), "utf-8")20return "data:image/png;base64," + base64_str212223@pytest.fixture(scope="session") # session so we don't read this over and over24def img2img_basic_image_base64() -> str:25return file_to_base64(os.path.join(test_files_path, "img2img_basic.png"))262728@pytest.fixture(scope="session") # session so we don't read this over and over29def mask_basic_image_base64() -> str:30return file_to_base64(os.path.join(test_files_path, "mask_basic.png"))313233@pytest.fixture(scope="session")34def initialize() -> None:35import webui # noqa: F401363738