Files
llmsecops-research/tests/pytest.ini
2025-06-12 20:22:39 -06:00

141 lines
3.8 KiB
INI

# pytest.ini - Comprehensive configuration for unit, integration, and e2e tests
[pytest]
# Minimum pytest version required
minversion = 6.0
# Test discovery patterns
python_files = test_*.py *_test.py
python_classes = Test* *Tests
python_functions = test_*
# Test paths - pytest will look for tests in these directories
testpaths =
tests
tests/unit
tests/integration
tests/e2e
# Additional command line options (applied to every pytest run)
addopts =
# Verbose output with more details
-v
# Show extra test summary info for all except passed tests
-ra
# Show local variables in tracebacks
--tb=short
# Enable strict mode for markers and configuration
--strict-markers
--strict-config
# Capture stdout/stderr per-test
--capture=no
# Show slowest 10 tests
--durations=10
# Enable coverage reporting (requires pytest-cov)
--cov=src
--cov-report=term-missing
--cov-report=html:htmlcov
--cov-report=xml
# Fail if coverage is below threshold
--cov-fail-under=80
# Test markers - define custom markers to avoid warnings
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
fast: marks tests as fast
unit: marks tests as unit tests
integration: marks tests as integration tests
e2e: marks tests as end-to-end tests
smoke: marks tests as smoke tests
regression: marks tests as regression tests
api: marks tests as API tests
ui: marks tests as UI tests
database: marks tests that require database
network: marks tests that require network access
external: marks tests that depend on external services
skip_ci: marks tests to skip in CI environment
windows_only: marks tests that only run on Windows
linux_only: marks tests that only run on Linux
mac_only: marks tests that only run on macOS
# Ignore certain directories and files during test collection
ignore =
setup.py
conftest.py
migrations/
.tox/
build/
dist/
*.egg
.git/
__pycache__/
.pytest_cache/
node_modules/
.env/
# Configure logging
log_cli = true
log_cli_level = INFO
log_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S
log_file = tests/logs/pytest.log
log_file_level = DEBUG
log_file_format = %(asctime)s [%(levelname)8s] %(filename)s:%(lineno)d: %(message)s
log_file_date_format = %Y-%m-%d %H:%M:%S
# Configure warnings
filterwarnings =
error
ignore::UserWarning
ignore::DeprecationWarning
ignore::PendingDeprecationWarning
ignore:.*U.*mode is deprecated:DeprecationWarning
# Test timeout (requires pytest-timeout)
timeout = 300
timeout_method = thread
# Parallel execution configuration (requires pytest-xdist)
# Uncomment to enable parallel test execution
# addopts = -n auto
# Configure test collection
collect_ignore = [
"setup.py",
"conftest.py"
]
# Minimum line length for test output
console_output_style = progress
# Configure doctest options
doctest_optionflags =
NORMALIZE_WHITESPACE
IGNORE_EXCEPTION_DETAIL
ELLIPSIS
# Configure test session data
cache_dir = .pytest_cache
# Configure temporary directory for tests
tmp_path_retention_count = 3
tmp_path_retention_policy = failed
# Additional ini options for specific plugins can be added here
# For example, if using pytest-mock:
# mock_use_standalone_module = true
# For pytest-html reports:
# addopts = --html=reports/report.html --self-contained-html
# For pytest-bdd:
# bdd_features_base_dir = features/
# Environment variables can be set (requires pytest-env)
env =
export MODEL_BASE_DIR="./infrastructure/foundation_model"
export MODEL_CPU_DIR="cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4"
MODEL_DATA_FILENAME="phi3-mini-4k-instruct-cpu-int4-rtn-block-32-acc-level-4.onnx.data"
MODEL_DATA_FILEPATH="$MODEL_BASE_DIR/$MODEL_CPU_DIR/$MODEL_DATA_FILENAME"