diff --git a/e2e-pw/src/shared/python-runner/python-runner.ts b/e2e-pw/src/shared/python-runner/python-runner.ts index 81aa287f97..e865774aa0 100644 --- a/e2e-pw/src/shared/python-runner/python-runner.ts +++ b/e2e-pw/src/shared/python-runner/python-runner.ts @@ -10,7 +10,18 @@ dotenv.config({ path: process.env.CI ? ".env.ci" : ".env.dev" }); export type PythonCommandGenerator = (argv: string[]) => string; export class PythonRunner { - constructor(private pythonCommandGenerator: PythonCommandGenerator) {} + constructor( + private readonly pythonCommandGenerator: PythonCommandGenerator, + private readonly env?: Record + ) { + this.pythonCommandGenerator = pythonCommandGenerator; + + if (this.env) { + Object.entries(this.env).forEach(([key, value]) => { + process.env[key] = value; + }); + } + } public exec(sourceCode: string) { const dedentedSourceCode = dedentPythonCode(sourceCode);