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

Commit04ce393

Browse files
committed
Merge branch 'embedded_tests' into pythonnet_master
2 parentsc0fb3f2 +e75d1c2 commit04ce393

File tree

2 files changed

+62
-27
lines changed

2 files changed

+62
-27
lines changed

‎src/embed_tests/pyinitialize.cs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ namespace Python.EmbeddingTest
55
{
66
publicclassPyInitializeTest
77
{
8+
/// <summary>
9+
/// Tests issue with multiple simple Initialize/Shutdowns.
10+
/// Fixed by #343
11+
/// </summary>
812
[Test]
9-
publicstaticvoidLoadSpecificArgs()
13+
publicstaticvoidStartAndStopTwice()
1014
{
11-
varargs=new[]{"test1","test2"};
12-
using(newPythonEngine(args))
13-
using(varargv=newPyList(Runtime.Runtime.PySys_GetObject("argv")))
14-
{
15-
Assert.AreEqual(args[0],argv[0].ToString());
16-
Assert.AreEqual(args[1],argv[1].ToString());
17-
}
15+
PythonEngine.Initialize();
16+
PythonEngine.Shutdown();
17+
18+
PythonEngine.Initialize();
19+
PythonEngine.Shutdown();
1820
}
1921

2022
[Test]
@@ -28,17 +30,24 @@ public static void LoadDefaultArgs()
2830
}
2931

3032
[Test]
31-
publicstaticvoidStartAndStopTwice()
33+
publicstaticvoidLoadSpecificArgs()
3234
{
33-
PythonEngine.Initialize();
34-
PythonEngine.Shutdown();
35-
36-
PythonEngine.Initialize();
37-
PythonEngine.Shutdown();
35+
varargs=new[]{"test1","test2"};
36+
using(newPythonEngine(args))
37+
using(varargv=newPyList(Runtime.Runtime.PySys_GetObject("argv")))
38+
{
39+
Assert.AreEqual(args[0],argv[0].ToString());
40+
Assert.AreEqual(args[1],argv[1].ToString());
41+
}
3842
}
3943

44+
/// <summary>
45+
/// Failing test demonstrating current issue with OverflowException (#376)
46+
/// and ArgumentException issue after that one is fixed.
47+
/// More complex version of StartAndStopTwice test
48+
/// </summary>
4049
[Test]
41-
[Ignore("System.OverflowException : Arithmetic operation resulted in an overflow")]
50+
[Ignore("GH#376:System.OverflowException : Arithmetic operation resulted in an overflow")]
4251
//[Ignore("System.ArgumentException : Cannot pass a GCHandle across AppDomains")]
4352
publicvoidReInitialize()
4453
{

‎src/embed_tests/pytuple.cs

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ namespace Python.EmbeddingTest
55
{
66
publicclassPyTupleTest
77
{
8+
/// <summary>
9+
/// Test IsTupleType without having to Initialize a tuple.
10+
/// PyTuple constructor use IsTupleType. This decouples the tests.
11+
/// </summary>
12+
[Test]
13+
publicvoidTestStringIsTupleType()
14+
{
15+
using(Py.GIL())
16+
{
17+
vars=newPyString("foo");
18+
Assert.IsFalse(PyTuple.IsTupleType(s));
19+
}
20+
}
21+
22+
/// <summary>
23+
/// Test IsTupleType with Tuple.
24+
/// </summary>
25+
[Test]
26+
publicvoidTestPyTupleIsTupleType()
27+
{
28+
using(Py.GIL())
29+
{
30+
vart=newPyTuple();
31+
Assert.IsTrue(PyTuple.IsTupleType(t));
32+
}
33+
}
34+
835
[Test]
936
publicvoidTestPyTupleEmpty()
1037
{
@@ -15,7 +42,15 @@ public void TestPyTupleEmpty()
1542
}
1643
}
1744

45+
/// <remarks>
46+
/// FIXME: Unable to unload AppDomain, Unload thread timed out.
47+
/// Seen on Travis/AppVeyor on both PY2 and PY3. Causes Embedded_Tests
48+
/// to hang after they are finished for ~40 seconds until nunit3 forces
49+
/// a timeout on unloading tests. Doesn't fail the tests though but
50+
/// greatly slows down CI. nunit2 silently has this issue.
51+
/// </remarks>
1852
[Test]
53+
[Ignore("GH#397: Travis/AppVeyor: Unable to unload AppDomain, Unload thread timed out")]
1954
publicvoidTestPyTupleInvalidAppend()
2055
{
2156
using(Py.GIL())
@@ -39,18 +74,6 @@ public void TestPyTupleValidAppend()
3974
}
4075
}
4176

42-
[Test]
43-
publicvoidTestPyTupleIsTupleType()
44-
{
45-
using(Py.GIL())
46-
{
47-
vars=newPyString("foo");
48-
vart=newPyTuple();
49-
Assert.IsTrue(PyTuple.IsTupleType(t));
50-
Assert.IsFalse(PyTuple.IsTupleType(s));
51-
}
52-
}
53-
5477
[Test]
5578
publicvoidTestPyTupleStringConvert()
5679
{
@@ -78,6 +101,9 @@ public void TestPyTupleValidConvert()
78101
}
79102
}
80103

104+
/// <remarks>
105+
/// FIXME: Possible source of intermittent AppVeyor PY27: Unable to unload AppDomain.
106+
/// </remarks>
81107
[Test]
82108
publicvoidTestNewPyTupleFromPyTuple()
83109
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp