Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bug: Py_Initialize/Py_Finalize calls during alive PythonEngine. Fixed.
  • Loading branch information
dse committed Sep 2, 2017
commit 64acfcb34abac5c0fa3722eea44c758b96da9d49
15 changes: 13 additions & 2 deletions src/embed_tests/TestRuntime.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
using System;
using System;
using NUnit.Framework;
using Python.Runtime;

namespace Python.EmbeddingTest
{
public class TestRuntime
{
[OneTimeSetUp]
public void SetUp()
{
// We needs to ensure that no any engines are running.
if (PythonEngine.IsInitialized)
{
PythonEngine.Shutdown();
}
}

[Test]
public static void Py_IsInitializedValue()
{
Runtime.Runtime.Py_Finalize(); // In case another test left it on.
// We defenitely knows that all engines are shut downed.
// Runtime.Runtime.Py_Finalize();
Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized());
Runtime.Runtime.Py_Initialize();
Assert.AreEqual(1, Runtime.Runtime.Py_IsInitialized());
Expand Down