Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ensure tests, that need runningPythonEngine have similarSetUp andTearDown#1564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lostmsu merged 1 commit intopythonnet:masterfromlosttech:test-same-setup
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
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
10 changes: 4 additions & 6 deletionssrc/embed_tests/References.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,18 +5,16 @@ namespace Python.EmbeddingTest

publicclassReferences
{
privatePy.GILState_gs;

[SetUp]
[OneTimeSetUp]
publicvoidSetUp()
{
_gs=Py.GIL();
PythonEngine.Initialize();
}

[TearDown]
[OneTimeTearDown]
publicvoidDispose()
{
_gs.Dispose();
PythonEngine.Shutdown();
}

[Test]
Expand Down
10 changes: 4 additions & 6 deletionssrc/embed_tests/TestNativeTypeOffset.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,18 +13,16 @@ namespace Python.EmbeddingTest
{
public class TestNativeTypeOffset
{
private Py.GILState _gs;

[SetUp]
[OneTimeSetUp]
public void SetUp()
{
_gs = Py.GIL();
PythonEngine.Initialize();
}

[TearDown]
[OneTimeTearDown]
public void Dispose()
{
_gs.Dispose();
PythonEngine.Shutdown();
}

/// <summary>
Expand Down
8 changes: 2 additions & 6 deletionssrc/embed_tests/TestPythonException.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,19 +6,15 @@ namespace Python.EmbeddingTest
{
public class TestPythonException
{
private IntPtr _gs;

[SetUp]
[OneTimeSetUp]
public void SetUp()
{
PythonEngine.Initialize();
_gs = PythonEngine.AcquireLock();
}

[TearDown]
[OneTimeTearDown]
public void Dispose()
{
PythonEngine.ReleaseLock(_gs);
PythonEngine.Shutdown();
}

Expand Down
20 changes: 4 additions & 16 deletionssrc/embed_tests/dynamic.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,28 +7,16 @@ namespace Python.EmbeddingTest
{
publicclassDynamicTest
{
privatePy.GILState_gs;

[SetUp]
[OneTimeSetUp]
publicvoidSetUp()
{
try{
_gs=Py.GIL();
}catch(Exceptione){
Console.WriteLine($"exception in SetUp:{e}");
throw;
}
PythonEngine.Initialize();
}

[TearDown]
[OneTimeTearDown]
publicvoidDispose()
{
try{
_gs.Dispose();
}catch(Exceptione){
Console.WriteLine($"exception in TearDown:{e}");
throw;
}
PythonEngine.Shutdown();
}

/// <summary>
Expand Down
8 changes: 2 additions & 6 deletionssrc/embed_tests/pyimport.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,10 @@ namespace Python.EmbeddingTest
/// </remarks>
public class PyImportTest
{
private IntPtr _gs;

[SetUp]
[OneTimeSetUp]
public void SetUp()
{
PythonEngine.Initialize();
_gs = PythonEngine.AcquireLock();

/* Append the tests directory to sys.path
* using reflection to circumvent the private
Expand All@@ -41,10 +38,9 @@ public void SetUp()
Runtime.Runtime.XDecref(str);
}

[TearDown]
[OneTimeTearDown]
public void Dispose()
{
PythonEngine.ReleaseLock(_gs);
PythonEngine.Shutdown();
}

Expand Down
10 changes: 4 additions & 6 deletionssrc/embed_tests/pyrunstring.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,18 +6,16 @@ namespace Python.EmbeddingTest
{
public class RunStringTest
{
private Py.GILState _gs;

[SetUp]
[OneTimeSetUp]
public void SetUp()
{
_gs = Py.GIL();
PythonEngine.Initialize();
}

[TearDown]
[OneTimeTearDown]
public void Dispose()
{
_gs.Dispose();
PythonEngine.Shutdown();
}

[Test]
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp