Skip to content

Allow code editors to collect tests#5997

Merged
florentinl merged 1 commit intomainfrom
florentin.labelle/collect-only-support
Jan 12, 2026
Merged

Allow code editors to collect tests#5997
florentinl merged 1 commit intomainfrom
florentin.labelle/collect-only-support

Conversation

@florentinl
Copy link
Copy Markdown
Contributor

@florentinl florentinl commented Jan 11, 2026

Motivation

The goal of this PR is to fix calling pytest with --collect-only.
This allows using the vscode python extension to collect, run and debug system-tests.

Changes

  • Guard scenario cleanup for --collect-only

  • Guard scenario properties for --collect-only (as querying values such as weblog version will fail without running containers)

  • Return the number of bytes written when patching the write function for scrubbing (the vscode_pytest plugin inherits this wrapped write function to write to a pipe and relies on this behavior of the original write function)

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions
Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

conftest.py                                                             @DataDog/system-tests-core
utils/_context/_scenarios/core.py                                       @DataDog/system-tests-core
utils/_context/core.py                                                  @DataDog/system-tests-core
utils/proxy/scrubber.py                                                 @DataDog/system-tests-core

@florentinl florentinl force-pushed the florentin.labelle/collect-only-support branch from 238b334 to 68937ab Compare January 11, 2026 18:35
@florentinl florentinl marked this pull request as ready for review January 12, 2026 09:16
@florentinl florentinl requested a review from a team as a code owner January 12, 2026 09:16
@cbeauchesne cbeauchesne changed the title core: fix --collect-only Allow code editors to collect tests Jan 12, 2026
Copy link
Copy Markdown
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small non blocking comment.

I changed the title, as this PR definitly deserves a change log mention.

TYVM !

Comment thread utils/proxy/scrubber.py
data = data.replace(secret, "--redacted--")

original_write(data)
return original_write(data)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change belongs to this PR ?

Copy link
Copy Markdown
Contributor Author

@florentinl florentinl Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the vscode extension injects a pytest plugin that inherits the wrapped write and needs its return value. Otherwise the test discovery crashes.

@florentinl florentinl merged commit 8a9c1eb into main Jan 12, 2026
2107 checks passed
@florentinl florentinl deleted the florentin.labelle/collect-only-support branch January 12, 2026 09:34
florentinl added a commit that referenced this pull request Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants