Skip to content

xUnit test runner fails to find module dictionary #372

Closed
@vmuriart

Description

@vmuriart

Environment

  • Pythonnet version: v2.2.2
  • Python version: all
  • Operating System: Windows

Details

  • Describe what you were trying to get done.

Replace nUnit to xUnit framework.

Below is one of the tests rewritten for xUnit

using System.Collections.Generic;
using Xunit;
using Python.Runtime;

namespace Python.EmbeddingTest
{
    public class PyIterTest
    {
        [Fact]
        public void TestOnPyList()
        {
            using (Py.GIL())
            {
                var list = new PyList();
                list.Append(new PyString("foo"));
                list.Append(new PyString("bar"));
                list.Append(new PyString("baz"));
                var result = new List<string>();
                foreach (PyObject item in list)
                {
                    result.Add(item.ToString());
                }
                Assert.Equal(3, result.Count);
                Assert.Equal("foo", result[0]);
                Assert.Equal("bar", result[1]);
                Assert.Equal("baz", result[2]);
            }
        }
    }
}
  • If there was a crash, please include the traceback here.
Error msg: Fatal Python error: PyImport_GetModuleDict: no module dictionary!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions