Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

test(dotnet): run the tests that share the process-wide warning state one at a time

kevin-gatimu7aa59f4787ec
diff --git a/laya-dotnet/tests/Laya.Tests/LangTemperatureTests.cs b/laya-dotnet/tests/Laya.Tests/LangTemperatureTests.cs
index 0c98504e..8e924518 100644
--- a/laya-dotnet/tests/Laya.Tests/LangTemperatureTests.cs
+++ b/laya-dotnet/tests/Laya.Tests/LangTemperatureTests.cs
@@ -10,6 +10,7 @@ namespace Laya.Tests;
/// <c>Router</c> over stub agents), and the token budgets against <c>build_sequence</c>. The decode itself, which
/// needs the weights, is pinned by the language cases of <see cref="PredictParityTests"/>.
/// </summary>
+[Collection(WarningStateCollection.Name)]
public sealed class LangTemperatureTests
{
private sealed class Capture : TraceListener
diff --git a/laya-dotnet/tests/Laya.Tests/PythonJsonReaderTests.cs b/laya-dotnet/tests/Laya.Tests/PythonJsonReaderTests.cs
index 680ccda0..fa9cee81 100644
--- a/laya-dotnet/tests/Laya.Tests/PythonJsonReaderTests.cs
+++ b/laya-dotnet/tests/Laya.Tests/PythonJsonReaderTests.cs
@@ -436,7 +436,19 @@ public sealed class PythonJsonReaderTests
}
}
+/// <summary>
+/// Classes that observe or reset the process-wide warning state (<see cref="WarnOnce"/>, <c>Trace.Listeners</c>) share
+/// this collection, and it never runs in parallel: xunit runs it alone, so no other class warns or resets meanwhile.
+/// </summary>
+[CollectionDefinition(Name, DisableParallelization = true)]
+public sealed class WarningStateCollection
+{
+ /// <summary>The collection name.</summary>
+ public const string Name = "warning-state";
+}
+
/// <summary>Python's default warnings filter: one trace per distinct (site, text) per process.</summary>
+[Collection(WarningStateCollection.Name)]
public sealed class WarnOnceTests
{
private sealed class Capture : TraceListener
diff --git a/laya-dotnet/tests/Laya.Tests/TemperatureConfigTests.cs b/laya-dotnet/tests/Laya.Tests/TemperatureConfigTests.cs
index 1e999a7a..9a440959 100644
--- a/laya-dotnet/tests/Laya.Tests/TemperatureConfigTests.cs
+++ b/laya-dotnet/tests/Laya.Tests/TemperatureConfigTests.cs
@@ -8,6 +8,7 @@ namespace Laya.Tests;
/// functions in <c>laya/common.py</c> (CPython 3.12) on <c>json.loads(value)</c>, with the entry text
/// built as <c>onnx_agent.py</c> builds it: <c>"%s=%r -> %g"</c>.
/// </summary>
+[Collection(WarningStateCollection.Name)]
public sealed class TemperatureConfigTests
{
[Theory]