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

Appearance settings

xUnit test runner fails to find module dictionary #372

Copy link
Copy link
@vmuriart

Description

@vmuriart
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.