mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-23 14:50:28 -07:00
* docs(M03): seed M03 plan and toolcalls Made-with: Cursor * ci: add repository guardrail, update CONTRIBUTING workflow Made-with: Cursor * M03: Test architecture (smoke/quality/nightly) - Move tests to test/smoke/, scaffold test/quality and test/nightly - Add pytest.ini with smoke/quality/nightly markers - Split CI: run_smoke_tests (PR), run_quality_tests (push main), run_nightly_tests (schedule) - Remove run_tests.yaml - Add prevent_upstream_push.sh pre-push hook template - Update CONTRIBUTING.md with hook install and test tier docs - Add repo and base-branch guardrails to workflows Made-with: Cursor * ci: remove obsolete warns_merge_master workflow (Serena uses main) Made-with: Cursor * fix: add base_url to pytest.ini for pytest-base-url plugin Made-with: Cursor * docs(M03): ledger, run1, audit, summary Made-with: Cursor * docs(M03): ledger commit 4ce5cde9 Made-with: Cursor
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
import base64
|
|
import os
|
|
|
|
import pytest
|
|
|
|
test_files_path = os.path.dirname(__file__) + "/test_files"
|
|
test_outputs_path = os.path.dirname(__file__) + "/test_outputs"
|
|
|
|
|
|
def pytest_configure(config):
|
|
# We don't want to fail on Py.test command line arguments being
|
|
# parsed by webui:
|
|
os.environ.setdefault("IGNORE_CMD_ARGS_ERRORS", "1")
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
"""Apply smoke/quality/nightly markers based on test path."""
|
|
for item in items:
|
|
path_str = str(item.path)
|
|
if "/smoke/" in path_str or "\\smoke\\" in path_str:
|
|
item.add_marker(pytest.mark.smoke)
|
|
elif "/quality/" in path_str or "\\quality\\" in path_str:
|
|
item.add_marker(pytest.mark.quality)
|
|
elif "/nightly/" in path_str or "\\nightly\\" in path_str:
|
|
item.add_marker(pytest.mark.nightly)
|
|
|
|
|
|
def file_to_base64(filename):
|
|
with open(filename, "rb") as file:
|
|
data = file.read()
|
|
|
|
base64_str = str(base64.b64encode(data), "utf-8")
|
|
return "data:image/png;base64," + base64_str
|
|
|
|
|
|
@pytest.fixture(scope="session") # session so we don't read this over and over
|
|
def img2img_basic_image_base64() -> str:
|
|
return file_to_base64(os.path.join(test_files_path, "img2img_basic.png"))
|
|
|
|
|
|
@pytest.fixture(scope="session") # session so we don't read this over and over
|
|
def mask_basic_image_base64() -> str:
|
|
return file_to_base64(os.path.join(test_files_path, "mask_basic.png"))
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def initialize() -> None:
|
|
import webui # noqa: F401
|