Add a test-sources configuration option. (#2062)

* Add test_sources configuration option.

* Add pyodide implementation.

* Modify default test behavior to run in the project directory.

* Update the test for running in the project directory.

* Apply suggestions from code review

Co-authored-by: Joe Rickerby <joerick@mac.com>

* Add shlex quoting to test-sources.

* Restructure ctypes example to avoid issues running from the project folder.

---------

Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Russell Keith-Magee
2025-01-10 15:24:24 +00:00
committed by GitHub
co-authored by Joe Rickerby
parent 4d0d9f6fd0
commit 0b82613d6f
16 changed files with 373 additions and 74 deletions
+4 -3
View File
@@ -101,18 +101,19 @@ ctypes_project.files["setup.py"] = textwrap.dedent(
setup(
name="ctypesexample",
version="1.0.0",
package_dir = {"": "src"},
py_modules = ["ctypesexample.summing"],
ext_modules=[
CTypesExtension(
"ctypesexample.csumlib",
["ctypesexample/csumlib.c"],
["src/ctypesexample/csumlib.c"],
),
],
cmdclass={'build_ext': build_ext, 'bdist_wheel': bdist_wheel_abi_none},
)
"""
)
ctypes_project.files["ctypesexample/csumlib.c"] = textwrap.dedent(
ctypes_project.files["src/ctypesexample/csumlib.c"] = textwrap.dedent(
"""
#ifdef _WIN32
#define LIBRARY_API __declspec(dllexport)
@@ -136,7 +137,7 @@ ctypes_project.files["ctypesexample/csumlib.c"] = textwrap.dedent(
}
"""
)
ctypes_project.files["ctypesexample/summing.py"] = textwrap.dedent(
ctypes_project.files["src/ctypesexample/summing.py"] = textwrap.dedent(
"""
import ctypes
import pathlib