PYTHON-5181 Make it easier to set debugging logging in an Evergreen patch (#2177)
This commit is contained in:
parent
f1fe49784b
commit
8927cfe79b
@ -262,7 +262,7 @@ functions:
|
||||
params:
|
||||
include_expansions_in_env: [AUTH, SSL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
|
||||
AWS_SESSION_TOKEN, COVERAGE, PYTHON_BINARY, LIBMONGOCRYPT_URL, MONGODB_URI,
|
||||
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION]
|
||||
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION, DEBUG_LOG]
|
||||
binary: bash
|
||||
working_dir: "src"
|
||||
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
|
||||
|
||||
@ -33,6 +33,6 @@ fi
|
||||
PIP_QUIET=0 uv run ${UV_ARGS} --with pip pip list
|
||||
|
||||
# Start the test runner.
|
||||
uv run ${UV_ARGS} .evergreen/scripts/run_tests.py
|
||||
uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@"
|
||||
|
||||
popd
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
@ -106,8 +107,11 @@ def run() -> None:
|
||||
test_kms_remote(SUB_TEST_NAME)
|
||||
return
|
||||
|
||||
if os.environ.get("DEBUG_LOG"):
|
||||
TEST_ARGS.extend(f"-o log_cli_level={logging.DEBUG} -o log_cli=1".split())
|
||||
|
||||
# Run local tests.
|
||||
pytest.main(TEST_ARGS)
|
||||
pytest.main(TEST_ARGS + sys.argv[1:])
|
||||
|
||||
# Handle perf test post actions.
|
||||
if TEST_PERF:
|
||||
|
||||
@ -26,7 +26,7 @@ from utils import (
|
||||
)
|
||||
|
||||
# Passthrough environment variables.
|
||||
PASS_THROUGH_ENV = ["GREEN_FRAMEWORK", "NO_EXT", "MONGODB_API_VERSION"]
|
||||
PASS_THROUGH_ENV = ["GREEN_FRAMEWORK", "NO_EXT", "MONGODB_API_VERSION", "DEBUG_LOG"]
|
||||
|
||||
# Map the test name to a test suite.
|
||||
TEST_SUITE_MAP = {
|
||||
|
||||
@ -227,6 +227,8 @@ the pages will re-render and the browser will automatically refresh.
|
||||
## Enable Debug Logs
|
||||
- Use `-o log_cli_level="DEBUG" -o log_cli=1` with `just test` or `pytest`.
|
||||
- Add `log_cli_level = "DEBUG` and `log_cli = 1` to the `tool.pytest.ini_options` section in `pyproject.toml` for Evergreen patches or to enable debug logs by default on your machine.
|
||||
- You can also set `DEBUG_LOG=1` and run either `just setup-tests` or `just-test`.
|
||||
- For evergreen patch builds, you can use `evergreen patch --param DEBUG_LOG=1` to enable debug logs for the patch.
|
||||
|
||||
## Re-sync Spec Tests
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user