Skip to content

Commit 55d4bbb

Browse files
committed
Enable embedded_tests to Travis w. conditional filters
Add conditional class skip to pytuple for Travis/PY27 Add individual filters to other tests as needed https://www.amido.com/code/conditional-ignore-nunit-and-the-ability-to-conditionally-ignore-a-test/ http://stackoverflow.com/a/16075029/5208670
1 parent 8f258ac commit 55d4bbb

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ script:
4242
- python -m pytest
4343

4444
- cp Python.Runtime.dll.config src/embed_tests/bin/
45-
# - mono ./packages/NUnit.*/tools/nunit3-console.exe src/embed_tests/bin/Python.EmbeddingTest.dll
45+
- mono ./packages/NUnit.*/tools/nunit3-console.exe src/embed_tests/bin/Python.EmbeddingTest.dll
4646

4747
after_script:
4848
# Uncomment if need to geninterop, ie. py37 final

src/embed_tests/dynamic.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,35 @@ public void AssignNone()
5858
/// Check whether we can get the attr of a python object when the
5959
/// value of attr is a PyObject.
6060
/// </summary>
61+
/// <remarks>
62+
/// FIXME: Issue on Travis PY27: Error : Python.EmbeddingTest.dynamicTest.AssignPyObject
63+
/// Python.Runtime.PythonException : ImportError : /home/travis/virtualenv/python2.7.9/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyLong_AsInt
64+
/// </remarks>
6165
[Test]
6266
public void AssignPyObject()
6367
{
68+
if (Environment.GetEnvironmentVariable("TRAVIS") == "true" &&
69+
Environment.GetEnvironmentVariable("TRAVIS_PYTHON_VERSION") == "2.7")
70+
{
71+
// Most recently threw `auto-releasing thread-state, but no thread-state for this thread`
72+
// instead of the error below. Maybe had bad mapping to library?
73+
Assert.Ignore("Fails on Travis/PY27: ImportError: ... undefined symbol: _PyLong_AsInt");
74+
}
75+
6476
dynamic sys = Py.Import("sys");
6577
dynamic io = Py.Import("io");
6678
sys.testattr = io.StringIO();
67-
dynamic bb = sys.testattr; //Get the PyObject
79+
dynamic bb = sys.testattr; // Get the PyObject
6880
bb.write("Hello!");
6981
Assert.AreEqual(bb.getvalue().ToString(), "Hello!");
7082
}
7183

7284
/// <summary>
7385
/// Pass the .NET object in Python side.
7486
/// </summary>
87+
/// <remarks>
88+
/// FIXME: Possible source of intermittent Travis PY27: Unable to unload AppDomain.
89+
/// </remarks>
7590
[Test]
7691
public void PassObjectInPython()
7792
{

src/embed_tests/pyinitialize.cs

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public static void LoadDefaultArgs()
3333
[Test]
3434
public static void LoadSpecificArgs()
3535
{
36+
if (Environment.GetEnvironmentVariable("TRAVIS") == "true" &&
37+
Environment.GetEnvironmentVariable("TRAVIS_PYTHON_VERSION") != "2.7")
38+
{
39+
Assert.Ignore("FIXME: Fails on Travis/PY3+: Fatal Python error: no mem for sys.argv");
40+
}
3641
var args = new[] { "test1", "test2" };
3742
using (new PythonEngine(args))
3843
using (var argv = new PyList(Runtime.Runtime.PySys_GetObject("argv")))

src/embed_tests/pytuple.cs

+28
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,37 @@ namespace Python.EmbeddingTest
66
{
77
public class PyTupleTest
88
{
9+
/// <summary>
10+
/// Tests set-up. Being used to skip class on Travis/PY27
11+
/// </summary>
12+
/// <remarks>
13+
/// FIXME: Fails on Travis/PY27: All tests below (unless otherwise stated)
14+
/// Fatal Python error: auto-releasing thread-state, but no thread-state for this thread
15+
/// Stacktrace:
16+
/// at (wrapper managed-to-native) Python.Runtime.Runtime.PyGILState_Release (intptr)
17+
/// at Python.Runtime.PythonEngine.ReleaseLock (intptr)
18+
/// at Python.Runtime.PythonException.Dispose ()
19+
/// at Python.Runtime.PythonException.Finalize ()
20+
/// at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
21+
/// </remarks>
22+
[SetUp]
23+
public void SetUp()
24+
{
25+
if (Environment.GetEnvironmentVariable("TRAVIS") == "true" &&
26+
Environment.GetEnvironmentVariable("TRAVIS_PYTHON_VERSION") == "2.7")
27+
{
28+
Assert.Ignore("Fails on Travis/PY27: Fatal Python error: auto-releasing thread-state, but no thread-state for this thread");
29+
}
30+
}
31+
932
/// <summary>
1033
/// Test IsTupleType without having to Initialize a tuple.
1134
/// PyTuple constructor use IsTupleType. This decouples the tests.
1235
/// </summary>
36+
/// <remarks>
37+
/// Travis PY27 intermittently fails this test. Indicates issue is
38+
/// most likely with PyTuple.IsTupleType
39+
/// </remarks>
1340
[Test]
1441
public void TestStringIsTupleType()
1542
{
@@ -104,6 +131,7 @@ public void TestPyTupleValidConvert()
104131

105132
/// <remarks>
106133
/// FIXME: Possible source of intermittent AppVeyor PY27: Unable to unload AppDomain.
134+
/// FIXME: Intermittent Issue on Travis PY33: Fatal Python error: PyMUTEX_LOCK(gil_mutex) failed. Seen twice.
107135
/// </remarks>
108136
[Test]
109137
public void TestNewPyTupleFromPyTuple()

0 commit comments

Comments
 (0)