From 1d27c7d423f4e7b2c1f2e9b68d99a33ac26d81eb Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Mon, 21 Nov 2022 15:13:24 +0100 Subject: [PATCH] tests/misc: Add test for cexample module. This also moves the existing test for cexample.add_ints originally done in extra_coverage. Signed-off-by: Laurens Valk --- tests/misc/cexample_module.py | 14 ++++++++++++++ tests/misc/cexample_module.py.exp | 2 ++ tests/unix/extra_coverage.py | 5 ----- tests/unix/extra_coverage.py.exp | 1 - 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 tests/misc/cexample_module.py create mode 100644 tests/misc/cexample_module.py.exp diff --git a/tests/misc/cexample_module.py b/tests/misc/cexample_module.py new file mode 100644 index 000000000..cf1d46f75 --- /dev/null +++ b/tests/misc/cexample_module.py @@ -0,0 +1,14 @@ +# test custom builtin module + +try: + import cexample +except ImportError: + print("SKIP") + raise SystemExit + +print(cexample) + +d = dir(cexample) +d.index("add_ints") + +print(cexample.add_ints(1, 3)) diff --git a/tests/misc/cexample_module.py.exp b/tests/misc/cexample_module.py.exp new file mode 100644 index 000000000..81fcc2f2d --- /dev/null +++ b/tests/misc/cexample_module.py.exp @@ -0,0 +1,2 @@ + +4 diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 00226a68e..a51b5b856 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -49,11 +49,6 @@ print(buf.write(bytearray(16))) # function defined in C++ code print("cpp", extra_cpp_coverage()) -# test user C module -import cexample - -print(cexample.add_ints(3, 2)) - # test user C module mixed with C++ code import cppexample diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 2f5409b85..2f8e37c5f 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -179,7 +179,6 @@ OSError None None cpp None -5 (3, 'hellocpp') frzstr1 frzstr1.py