CoolFace
Apppublic

brunvelop/ComfyUI

sourceHugging Faceupdated 3y agoView on Hugging Face
2likes
conftest.py37 linesDownload Raw Back to tests
1import os2import pytest3 4# Command line arguments for pytest5def pytest_addoption(parser):6    parser.addoption('--output_dir', action="store", default='tests/inference/samples', help='Output directory for generated images')7    parser.addoption("--listen", type=str, default="127.0.0.1", metavar="IP", nargs="?", const="0.0.0.0", help="Specify the IP address to listen on (default: 127.0.0.1). If --listen is provided without an argument, it defaults to 0.0.0.0. (listens on all)")8    parser.addoption("--port", type=int, default=8188, help="Set the listen port.")9 10# This initializes args at the beginning of the test session11@pytest.fixture(scope="session", autouse=True)12def args_pytest(pytestconfig):13    args = {}14    args['output_dir'] = pytestconfig.getoption('output_dir')15    args['listen'] = pytestconfig.getoption('listen')16    args['port'] = pytestconfig.getoption('port')17 18    os.makedirs(args['output_dir'], exist_ok=True)19 20    return args21 22def pytest_collection_modifyitems(items):23    # Modifies items so tests run in the correct order24    25    LAST_TESTS = ['test_quality']26 27    # Move the last items to the end28    last_items = []29    for test_name in LAST_TESTS:30        for item in items.copy():31            print(item.module.__name__, item)32            if item.module.__name__  == test_name:33                last_items.append(item)34                items.remove(item)35 36    items.extend(last_items)37