Skip to content

Support // Env in the python test runner #58179

Description

@joyeecheung

Something I found very useful in V8's test runner (our Python test runner is a fork of a very old version of this) is the support of the // Environment variables comment (similar to the // Flags comment, this instructs the test runner to pass a particular flag when running the test)

// Environment Variables: LC_ALL=de

The way it's implemented in V8 can be found in e.g. here

ENV_PATTERN = re.compile(r"//\s+Environment Variables:(.*)")

We can probably just port similar logic to our fork in e.g. here

flags_match = FLAGS_PATTERN.search(source)

It would be handy to leave more logs in flaky tests via the use of // Env: NODE_DEBUG=foo or // Env: NODE_DEBUG_NATIVE=foo - trying to set the flag in the entire test job or the entire test suite would be uncanny since many tests also check that stdout/stderr is empty, and we probably only want to do this for selected flaky tests that don't care about stdout/stderr so that they leave more traces in the CI logs. This would also help simplifying many tests that only spawn child processes to customize the environment varaibles.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testIssues and PRs related to Node.js core tests and test infrastructure.toolsIssues and PRs related to the tools directory.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions