Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
persist-credentials: false
repository: 'DataDog/system-tests'
# Automatically managed, use scripts/update-system-tests-version to update
ref: '04070bed4dd644284690650abe291e632eb27cd9'
ref: '5a20302459c95e215b6f418e4b296142995baf2a'

- name: Download wheels to binaries directory
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
persist-credentials: false
repository: 'DataDog/system-tests'
# Automatically managed, use scripts/update-system-tests-version to update
ref: '04070bed4dd644284690650abe291e632eb27cd9'
ref: '5a20302459c95e215b6f418e4b296142995baf2a'

- name: Build runner
uses: ./.github/actions/install_runner
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
persist-credentials: false
repository: 'DataDog/system-tests'
# Automatically managed, use scripts/update-system-tests-version to update
ref: '04070bed4dd644284690650abe291e632eb27cd9'
ref: '5a20302459c95e215b6f418e4b296142995baf2a'
- name: Download wheels to binaries directory
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ variables:
DD_VPA_TEMPLATE: "vpa-template-cpu-p70-10percent-2x-oom-min-cap"
# CI_DEBUG_SERVICES: "true"
# Automatically managed, use scripts/update-system-tests-version to update
SYSTEM_TESTS_REF: "04070bed4dd644284690650abe291e632eb27cd9"
SYSTEM_TESTS_REF: "5a20302459c95e215b6f418e4b296142995baf2a"

default:
interruptible: true
Expand Down
14 changes: 14 additions & 0 deletions ddtrace/bootstrap/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
def cleanup_loaded_modules():
def drop(module_name):
# type: (str) -> None
module = sys.modules.get(module_name)
# Don't delete modules that are currently being imported (they might be None or incomplete)
# or that don't exist. This can happen when pytest's assertion rewriter is importing modules
# that themselves import ddtrace.auto, which triggers this cleanup during the import process.
if module is None:
return
# Skip modules that don't have a __spec__ attribute yet (still being imported)
if not hasattr(module, "__spec__"):
return
# Check if the module is currently being initialized
# During import, __spec__._initializing is True
spec = getattr(module, "__spec__", None)
if spec is not None and getattr(spec, "_initializing", False):
return
del sys.modules[module_name]

MODULES_REQUIRING_CLEANUP = ("gevent",)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fix some modules being unloaded too soon when using pytest + ddtrace + gevent.
Loading