cpython: d195ff5c44f4 (original) (raw)

Mercurial > cpython

changeset 69553:d195ff5c44f4 3.2

Issue #10914: Add a minimal embedding test to test_capi. [#10914]

Antoine Pitrou solipsis@pitrou.net
date Mon, 25 Apr 2011 21:21:07 +0200
parents 66ef5e844e6c
children 77cf9e4b144b
files .hgignore Lib/test/test_capi.py Makefile.pre.in Modules/_testembed.c
diffstat 4 files changed, 89 insertions(+), 4 deletions(-)[+] [-] .hgignore 1 Lib/test/test_capi.py 35 Makefile.pre.in 5 Modules/_testembed.c 52

line wrap: on

line diff

--- a/.hgignore +++ b/.hgignore @@ -64,3 +64,4 @@ PCbuild/.ncb PCbuild/.bsc PCbuild/Win32-temp-* pycache +Modules/_testembed

--- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -2,6 +2,7 @@

these are all functions testcapi exports whose name begins with 'test'.

from future import with_statement +import os import random import subprocess import sys @@ -141,8 +142,38 @@ class Test6012(unittest.TestCase): def test(self): self.assertEqual(_testcapi.argparsing("Hello", "World"), 1) + +class EmbeddingTest(unittest.TestCase): +

+ + def test_main():

for name in dir(testcapi): if name.startswith('test'): @@ -177,8 +208,6 @@ def test_main(): t.start() t.join()

- if name == "main": test_main()

--- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -394,7 +394,7 @@ LIBRARY_OBJS= [](#l3.3)

Default target

all: build_all -build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks +build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed

Compile a binary with gcc profile guided optimization.

profile-opt: @@ -539,6 +539,9 @@ Modules/Setup: $(srcdir)/Modules/Setup.d echo "-----------------------------------------------"; [](#l3.13) fi +Modules/_testembed: Modules/_testembed.o (LIBRARY)(LIBRARY) (LIBRARY)(LDLIBRARY) $(PY3LIBRARY)

############################################################################

Special rules for object files

new file mode 100644 --- /dev/null +++ b/Modules/_testembed.c @@ -0,0 +1,52 @@ +#include <Python.h> +#include <stdio.h> + +void print_subinterp(void) +{

+} + +int main(int argc, char *argv[]) +{

+

+

+

+

+

+

+}