将IronPython.Runtime.PythonDictionary与需要常规Python字典的库一起使用
我正在尝试将PyTest与IronPython结合使用,但Py中的一个模块需要一个纯Python字典,但却得到了一个IronPython.Runtime.PythonDictionary。有没有办法避免下面的错误?我可以假设修改py_apipkg.py模块将IronPython.Runtime.PythonDictionary与需要常规Python字典的库一起使用,python,windows,ironpython,pytest,Python,Windows,Ironpython,Pytest,我正在尝试将PyTest与IronPython结合使用,但Py中的一个模块需要一个纯Python字典,但却得到了一个IronPython.Runtime.PythonDictionary。有没有办法避免下面的错误?我可以假设修改py_apipkg.py模块 >>> import pytest Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C
>>> import pytest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pytest.py", line 12, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\_pytest\core.py", line 7, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\py\__init__.py", line 19, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\py\_apipkg.py", line 33, in initpkg
SystemError: Unsupported param dictionary type: IronPython.Runtime.PythonDictionary
导入pytest
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“C:\Program Files(x86)\IronPython 2.7\lib\site packages\pytest.py”,第12行,在
文件“C:\Program Files(x86)\IronPython 2.7\lib\site packages\\u pytest\core.py”,第7行,在
文件“C:\Program Files(x86)\IronPython 2.7\lib\site packages\py\\uuuuuu init\uuuuuuuuu.py”,第19行,在
文件“C:\Program Files(x86)\IronPython 2.7\lib\site packages\py\\u apipkg.py”,第33行,在initpkg中
SystemError:不支持的参数字典类型:IronPython.Runtime.PythonDictionary
使用unittest而不是PyTest
use unittest
然后确保您的测试用例类继承自unittest.TestCase
class Test(unittest.TestCase):
def Test1(self):
t = MyClass()
self.AssertEquals(1, t.One, 'Example')
IronPython.Runtime.PythonDictionary
是IronPython的内置dict类型。有些奇怪的事情正在发生。你能提出一个问题吗?