File tree 1 file changed +13
-3
lines changed 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
- using System ;
1
+ using System ;
2
2
using NUnit . Framework ;
3
3
using Python . Runtime ;
4
4
5
5
namespace Python . EmbeddingTest
6
6
{
7
7
public class TestRuntime
8
8
{
9
+ [ OneTimeSetUp ]
10
+ public void SetUp ( )
11
+ {
12
+ // We needs to ensure that no any engines are running.
13
+ if ( PythonEngine . IsInitialized )
14
+ {
15
+ PythonEngine . Shutdown ( ) ;
16
+ }
17
+ }
18
+
9
19
/// <summary>
10
20
/// Test the cache of the information from the platform module.
11
21
///
@@ -24,12 +34,12 @@ public static void PlatformCache()
24
34
25
35
// Don't shut down the runtime: if the python engine was initialized
26
36
// but not shut down by another test, we'd end up in a bad state.
27
- }
37
+ }
28
38
29
39
[ Test ]
30
40
public static void Py_IsInitializedValue ( )
31
41
{
32
- Runtime . Runtime . Py_Finalize ( ) ; // In case another test left it on.
42
+ Runtime . Runtime . Py_Finalize ( ) ;
33
43
Assert . AreEqual ( 0 , Runtime . Runtime . Py_IsInitialized ( ) ) ;
34
44
Runtime . Runtime . Py_Initialize ( ) ;
35
45
Assert . AreEqual ( 1 , Runtime . Runtime . Py_IsInitialized ( ) ) ;
You can’t perform that action at this time.
0 commit comments