8000 Add pyrestart and format embedded tests · pythonnet/pythonnet@70787f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70787f4

Browse files
committed
Add pyrestart and format embedded tests
1 parent fb48c78 commit 70787f4

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

src/embed_tests/Python.EmbeddingTest.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@
142142
<None Include="packages.config" />
143143
</ItemGroup>
144144
<ItemGroup>
145+
<Compile Include="pyrestart.cs" />
145146
<Compile Include="pyimport.cs" />
146-
<Compile Include="pyiter.cs">
147-
<SubType>Code</SubType>
148-
</Compile>
147+
<Compile Include="pyiter.cs" />
149148
<Compile Include="pyobject.cs" />
150149
<Compile Include="pythonexception.cs" />
151150
</ItemGroup>

src/embed_tests/packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
32
<packages>
43
<package id="NUnit" version="2.6.2" targetFramework="net40" />
54
</packages>

src/embed_tests/pyimport.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Reflection;
3-
using System.Collections.Generic;
43
using NUnit.Framework;
54
using Python.Runtime;
65

src/embed_tests/pyiter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ public void TestOnPyList()
3333
list.Append(new PyString("baz"));
3434
List<string> result = new List<string>();
3535
foreach (PyObject item in list)
36+
{
3637
result.Add(item.ToString());
38+
}
3739
Assert.AreEqual(3, result.Count);
3840
Assert.AreEqual("foo", result[0]);
3941
Assert.AreEqual("bar", result[1]);
4042
Assert.AreEqual("baz", result[2]);
4143
}
4244
}
43-
}
45+
}

src/embed_tests/pyobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ public void TestUnicode()
3030
Assert.AreEqual("foo\u00e9", s.ToString());
3131
}
3232
}
33-
}
33+
}

src/embed_tests/pyrestart.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using NUnit.Framework;
2+
using Python.Runtime;
3+
4+
namespace Python.EmbeddingTest
5+
{
6+
[TestFixture]
7+
public class PyRestartTest
8+
{
9+
[Test]
10+
public void TestRestart()
11+
{
12+
PythonEngine.Initialize();
13+
PythonEngine.Shutdown();
14+
15+
PythonEngine.Initialize();
16+
PythonEngine.Shutdown();
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)
0