def testCreatesComponents(self): src = tempfile.mkdtemp() for (name, contents) in SNIPPETS_FILES.items(): write(src, name, contents) dst = tempfile.mkdtemp() result = spawn(sys.executable, "tools/generatecodesnippets.py", src, dst) self.assertEquals(result, 0, "process ended badly") def assertFinds(name, expected): text = read(dst, '%s.Generated.cs' % name) self.assertNotEquals(text.find(expected), -1, "generated: >>>%s<<<" % text) assertFinds('CodeSnippets', EXPECTED_SNIPPETS) shutil.rmtree(src) shutil.rmtree(dst)
def testCreatesComponents(self): src = tempfile.mkdtemp() for (name, contents) in SNIPPETS_FILES.items(): write(src, name, contents) dst = tempfile.mkdtemp() result = spawn("ipy", "tools/generatecodesnippets.py", src, dst) self.assertEquals(result, 0, "process ended badly") def assertFinds(name, expected): text = read(dst, '%s.Generated.cs' % name) self.assertNotEquals(text.find(expected), -1, "generated: >>>%s<<<" % text) assertFinds('CodeSnippets', EXPECTED_SNIPPETS) shutil.rmtree(src) shutil.rmtree(dst)
def testCreatesComponents(self): src = tempfile.mkdtemp() write(src, '_register_exceptions', REGISTER_EXCEPTIONS) write(src, '_register_types', REGISTER_TYPES) write(src, '_numbers_c2py', NUMBERS_C2PY) write(src, '_numbers_py2c', NUMBERS_PY2C) write(src, '_operator', OPERATOR) write(src, '_storedispatch', STOREDISPATCH) dst = tempfile.mkdtemp() result = spawn(sys.executable, 'tools/generatemapper.py', src, dst) self.assertEquals(result, 0, 'process ended badly') def assertFinds(name, expected): text = read(dst, '%s.Generated.cs' % name) self.assertNotEquals(text.find(expected), -1, 'generated: >>>%s<<<' % text) assertFinds('PythonMapper_register_exceptions', EXPECTED_REGISTER_EXCEPTIONS) assertFinds('PythonMapper_register_types', EXPECTED_REGISTER_TYPES) assertFinds('PythonMapper_numbers_c2py', EXPECTED_NUMBERS_C2PY) assertFinds('PythonMapper_numbers_py2c', EXPECTED_NUMBERS_PY2C) assertFinds('PythonMapper_operator', EXPECTED_OPERATOR) assertFinds('PythonMapper_storedispatch', EXPECTED_STOREDISPATCH) shutil.rmtree(src) shutil.rmtree(dst)
import os, sys from tools.utils.dllreader import DllReader from tools.utils.io import write #========================================================================== if __name__ == '__main__': src, dst = sys.argv[1:] dr = DllReader(src) write(dst, "_exported_functions.generated", '\n'.join(dr.functions), badge=True) #==========================================================================
def testCreatesComponents(self): src = tempfile.mkdtemp() write(src, "_register_exceptions", REGISTER_EXCEPTIONS) write(src, "_register_types", REGISTER_TYPES) write(src, "_numbers_c2py", NUMBERS_C2PY) write(src, "_numbers_py2c", NUMBERS_PY2C) write(src, "_operator", OPERATOR) write(src, "_storedispatch", STOREDISPATCH) dst = tempfile.mkdtemp() result = spawn("ipy", "tools/generatemapper.py", src, dst) self.assertEquals(result, 0, "process ended badly") def assertFinds(name, expected): text = read(dst, "%s.Generated.cs" % name) self.assertNotEquals(text.find(expected), -1, "generated: >>>%s<<<" % text) assertFinds("PythonMapper_register_exceptions", EXPECTED_REGISTER_EXCEPTIONS) assertFinds("PythonMapper_register_types", EXPECTED_REGISTER_TYPES) assertFinds("PythonMapper_numbers_c2py", EXPECTED_NUMBERS_C2PY) assertFinds("PythonMapper_numbers_py2c", EXPECTED_NUMBERS_PY2C) assertFinds("PythonMapper_operator", EXPECTED_OPERATOR) assertFinds("PythonMapper_storedispatch", EXPECTED_STOREDISPATCH) shutil.rmtree(src) shutil.rmtree(dst)