option to indicate running in threaded env, related to #13

This commit is contained in:
Florian Förster 2025-04-30 11:22:16 +02:00
parent c1d4062391
commit 6558d0818c
3 changed files with 17 additions and 2 deletions

View File

@ -252,5 +252,20 @@ namespace dopt.DeltaBarth.Tests
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code); Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
test.Dispose(); test.Dispose();
} }
[TestMethod]
public void Umsatzprognose_WithoutCompanyIdWithValidDate_Test_DoubleDispose()
{
var test = new TPlugin();
string apiUrlSet = config.apiUrl, user = config.username, password = config.password, database = config.database, mandant = config.mandant;
test.Startup(baseDataPath, apiUrlSet, user, password, database, mandant);
var date = new DateTime(2015, 1, 1, 12, 45, 30);
var res = test.Umsatzprognose(null, date);
PrettyPrint(res);
Assert.AreEqual(1, res.status.code);
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
test.Dispose();
test.Dispose();
Console.WriteLine("After double dispose");
}
} }
} }

View File

@ -93,7 +93,7 @@ namespace dopt.DeltaBarth
/// </summary> /// </summary>
/// <param name="runtimePath">Der Pfad zur Python-Runtime. Dieser muss zu dem Ordner zeigen, /// <param name="runtimePath">Der Pfad zur Python-Runtime. Dieser muss zu dem Ordner zeigen,
/// in welchem die Runtime in Form eines Ordners mit dem Namen "python" abliegt.</param> /// in welchem die Runtime in Form eines Ordners mit dem Namen "python" abliegt.</param>
public Plugin(string runtimePath) : base(SharpPython.PyOptimLevels.O, runtimePath: runtimePath, verbose: false) public Plugin(string runtimePath) : base(SharpPython.PyOptimLevels.O, threaded: true, runtimePath: runtimePath, verbose: false)
{ {
base.Initialise(); base.Initialise();
using (Py.GIL()) using (Py.GIL())

View File

@ -11,7 +11,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="dopt.SharpPython" Version="0.4.1" /> <PackageReference Include="dopt.SharpPython" Version="0.4.2-alpha3" />
</ItemGroup> </ItemGroup>
</Project> </Project>