Skip to content

Track Runtime run number #1074

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 23, 2021
Prev Previous commit
Next Next commit
allow tests to pass when objects are leaking due to being GCed after …
…Python runtime is shut down
  • Loading branch information
lostmsu committed Nov 12, 2021
commit 3909639ce1b0c17b66707208592a0d7c991645b6
16 changes: 16 additions & 0 deletions src/embed_tests/GlobalTestsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ namespace Python.EmbeddingTest
[SetUpFixture]
public partial class GlobalTestsSetup
{
[OneTimeSetUp]
public void GlobalSetup()
{
Finalizer.Instance.ErrorHandler += FinalizerErrorHandler;
}

private void FinalizerErrorHandler(object sender, Finalizer.ErrorArgs e)
{
if (e.Error is RuntimeShutdownException)
{
// allow objects to leak after the python runtime run
// they were created in is gone
e.Handled = true;
}
}

[OneTimeTearDown]
public void FinalCleanup()
{
Expand Down