Skip to content

Commit 16ee8d1

Browse files
net0wellclaude
andcommitted
test: ambiente limpo aceita as variáveis de threads do runner (spec 001)
No Linux sem cgroup delegável (como nos runners do GitHub), o limite de memória cai no RLIMIT_AS e o runner define OMP/OPENBLAS/MKL/NUMEXPR/VECLIB (D-180). O AC-11 tratava essas variáveis como herdadas do host e falhava no CI do Linux. O teste agora usa a lista do próprio executor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent df7dc3d commit 16ee8d1

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/PythonScriptRunner.Core/Execution/ProcessPythonExecutor.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal sealed class ProcessPythonExecutor(TimeProvider time, CgroupMemory cgro
1717
private const int ProtocolVersion = 1;
1818

1919
/// <summary>Thread pools of the numeric libraries (OpenMP, OpenBLAS, MKL, numexpr, Accelerate).</summary>
20-
private static readonly string[] ThreadVariables =
20+
internal static readonly string[] ThreadVariables =
2121
["OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS", "VECLIB_MAXIMUM_THREADS"];
2222
private static readonly TimeSpan KillWait = TimeSpan.FromSeconds(10);
2323
private static readonly TimeSpan PumpWait = TimeSpan.FromSeconds(5);

‎tests/PythonScriptRunner.Core.Tests/Integration/IsolationTests.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Diagnostics;
22
using System.Text.Json.Nodes;
3+
using PythonScriptRunner.Core.Execution;
34
using PythonScriptRunner.Core.Tests.Infrastructure;
45

56
namespace PythonScriptRunner.Core.Tests.Integration;
@@ -166,8 +167,9 @@ def run(inputs, ctx):
166167

167168
var names = result.GetOutput<JsonArray>("nomes").Select(n => n!.GetValue<string>().ToUpperInvariant()).ToList();
168169
names.ShouldNotContain("PSR_TEST_HOST_ONLY");
169-
// LC_CTYPE is set by the interpreter itself on Linux (PEP 538 locale coercion), not inherited from the host.
170-
string[] allowed = ["PATH", "SYSTEMROOT", "TEMP", "TMP", "TMPDIR", "HOME", "LC_CTYPE"];
170+
// LC_CTYPE is set by the interpreter itself on Linux (PEP 538 locale coercion), not inherited from the host. The
171+
// thread variables come from the runner when the memory limit falls back to RLIMIT_AS (Linux without cgroup; D-180).
172+
string[] allowed = ["PATH", "SYSTEMROOT", "TEMP", "TMP", "TMPDIR", "HOME", "LC_CTYPE", .. ProcessPythonExecutor.ThreadVariables];
171173
names.Where(n => !n.StartsWith("PSR_", StringComparison.Ordinal) && !allowed.Contains(n)).ShouldBeEmpty();
172174
}
173175

0 commit comments

Comments
 (0)