_____________ entrypoint: TestCarbonPython().test_export_cliclass ______________
def test_export_cliclass(self):
from pypy.translator.cli.dotnet import CLR
@export(CLR.System.Collections.ArrayList, int)
def getitem(obj, i):
return obj.get_Item(i)
entrypoints = collect_entrypoints({'getitem': getitem})
dll = DllDef('test', 'Test', entrypoints)
dll.compile()
> res = self._csharp("""
ArrayList obj = new ArrayList();
obj.Add(42);
Console.WriteLine(Test.getitem(obj, 0));
""", ['test'])
/home/arigo/autotest/pypy-dist/pypy/translator/cli/test/test_carbonpython.py:139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def _csharp(self, source, references=[], netmodules=[]):
tmpfile = udir.udir.join('tmp.cs')
tmpfile.write(TEMPLATE % source)
flags = ['/r:%s' % ref for ref in references]
flags += ['/addmodule:%s' % mod for mod in netmodules]
class MyTarget(Target):
SOURCES = [str(tmpfile)]
FLAGS = flags
OUTPUT = 'tmp.exe'
SRC_DIR = str(udir.udir)
func = CliFunctionWrapper(MyTarget.get())
> return func()
/home/arigo/autotest/pypy-dist/pypy/translator/cli/test/test_carbonpython.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def __call__(self, *args):
stdout, stderr, retval = self.run(*args)
E assert retval == 0, stderr
> AssertionError:
** (/tmp/usession-dist-12638/tmp.exe:15575): WARNING **: Missing method Test::foo(int) in assembly /tmp/usession-dist-12638/test.dll, referenced in assembly /tmp/usession-dist-12638/tmp.exe
Unhandled Exception: System.MissingMethodException: Method not found: 'Test.foo'.
/home/arigo/autotest/pypy-dist/pypy/translator/cli/test/runtest.py:214: AssertionError
________________________________________________________________________________