autogen/test/conftest.py
Eric Zhu 1abbcf3c44
Update tests for code_utils and use ThreadPoolExecutor for code execution in windows (#1472)
* threadpoolexecutor

* update tests

* update tests

* fix tests on windows

* fix test

* update tests

* update tests

* update tests

* update tests

* update tests

* update tests

* fix build.yml

* build yaml

* test

* use skip-docker to explicitly skipping docker tests

* update tests

* contribution doc update

* Update website/docs/Contribute.md

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* update doc

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
2024-02-04 15:08:14 +00:00

25 lines
1002 B
Python

import pytest
skip_openai = False
skip_redis = False
skip_docker = False
# Registers command-line options like '--skip-openai' and '--skip-redis' via pytest hook.
# When these flags are set, it indicates that tests requiring OpenAI or Redis (respectively) should be skipped.
def pytest_addoption(parser):
parser.addoption("--skip-openai", action="store_true", help="Skip all tests that require openai")
parser.addoption("--skip-redis", action="store_true", help="Skip all tests that require redis")
parser.addoption("--skip-docker", action="store_true", help="Skip all tests that require docker")
# pytest hook implementation extracting command line args and exposing it globally
@pytest.hookimpl(tryfirst=True)
def pytest_configure(config):
global skip_openai
skip_openai = config.getoption("--skip-openai", False)
global skip_redis
skip_redis = config.getoption("--skip-redis", False)
global skip_docker
skip_docker = config.getoption("--skip-docker", False)