File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using NUnit . Framework ;
3
+ using Python . Runtime ;
4
+
5
+ namespace Python . EmbeddingTest
6
+ {
7
+ [ SetUpFixture ]
8
+ public class FinalShutdown
9
+ {
10
+ [ OneTimeTearDown ]
11
+ public void Finalize ( )
12
+ {
13
+ TestContext . Progress . WriteLine ( "This is global shutdown!" ) ;
14
+ Console . Error . WriteLine ( "Trying finalyze test." ) ;
15
+ if ( PythonEngine . IsInitialized )
16
+ {
17
+ Console . Error . WriteLine ( "Direct shutdown!" ) ;
18
+ PythonEngine . Shutdown ( ) ;
19
+ }
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public void SetUp()
23
23
[ Test ]
24
24
public void SynchronousAllocationTest ( )
25
25
{
26
+ Console . Error . WriteLine ( "sync started" ) ;
26
27
// If GC does not works, we will consume 10G.
27
28
for ( int i = 0 ; i < 50 ; i ++ )
28
29
{
@@ -41,11 +42,13 @@ public void SynchronousAllocationTest()
41
42
42
43
// We need to consume less that 1Gb.
43
44
Assert . Less ( totalMemoryConsumed , 1000000000 ) ;
45
+ Console . Error . WriteLine ( "sync finished" ) ;
44
46
}
45
47
46
48
[ Test ]
47
49
public void AsyncAllocationTest ( )
48
50
{
51
+ Console . Error . WriteLine ( "Async started" ) ;
49
52
var gs = PythonEngine . BeginAllowThreads ( ) ;
50
53
try
51
54
{
@@ -77,6 +80,7 @@ public void AsyncAllocationTest()
77
80
78
81
// We need to consume less that 1Gb.
79
82
Assert . Less ( totalMemoryConsumed , 1000000000 ) ;
83
+ Console . Error . WriteLine ( "Async Finished" ) ;
80
84
}
81
85
}
82
86
}
You can’t perform that action at this time.
0 commit comments