cpython/Modules/_testcapi
Victor Stinner dc804ffb2f
gh-128911: Use PyImport_ImportModuleAttr() function (#129657)
* Replace PyImport_ImportModule() + PyObject_GetAttr() with
  PyImport_ImportModuleAttr().
* Replace PyImport_ImportModule() + PyObject_GetAttrString() with
  PyImport_ImportModuleAttrString().
2025-02-05 11:03:58 +01:00
..
clinic gh-111495: Add PyFile tests (#129449) 2025-01-30 18:05:32 +01:00
abstract.c
buffer.c
bytes.c
code.c gh-128911: Use PyImport_ImportModuleAttr() function (#129657) 2025-02-05 11:03:58 +01:00
codec.c
complex.c gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829) 2024-11-26 17:57:39 +02:00
config.c
datetime.c
dict.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
docstring.c
exceptions.c gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) 2024-12-17 12:12:45 +01:00
file.c gh-111495: Add PyFile tests (#129449) 2025-01-30 18:05:32 +01:00
float.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
frame.c gh-93649: Move PyFrame C API tests to test_capi (#129512) 2025-01-31 13:51:58 +01:00
function.c gh-93649: Add Modules/_testcapi/function.c file (#129521) 2025-01-31 16:02:50 +01:00
gc.c gh-129354: Use PyErr_FormatUnraisable() function (#129514) 2025-01-31 14:20:35 +01:00
getargs.c
hash.c
heaptype.c
immortal.c gh-127119: Faster check for small ints in long_dealloc (GH-127620) 2025-01-29 15:22:18 +00:00
import.c gh-128911: Add PyImport_ImportModuleAttr() function (#128912) 2025-01-30 11:17:29 +00:00
list.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
long.c gh-102471, PEP 757: Add PyLong import and export API (#121339) 2024-12-13 14:24:48 +01:00
mem.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
monitoring.c GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
numbers.c
object.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
parts.h gh-93649: Add Modules/_testcapi/function.c file (#129521) 2025-01-31 16:02:50 +01:00
pyatomic.c
README.txt
run.c
set.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
structmember.c gh-127572: Fix test_structmembers initialization (GH-127577) 2024-12-04 09:58:22 +01:00
time.c
tuple.c
type.c gh-93649: Add Modules/_testcapi/type.c file (#129516) 2025-01-31 15:03:54 +01:00
unicode.c
util.h
vectorcall.c
watchers.c gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475) 2025-01-31 09:45:35 +01:00

Tests in this directory are compiled into the _testcapi extension.
The main file for the extension is Modules/_testcapimodule.c, which
calls `_PyTestCapi_Init_*` from these functions.

General guideline when writing test code for C API.
* Use Argument Clinic to minimise the amount of boilerplate code.
* Add a newline between the argument spec and the docstring.
* If a test description is needed, make sure the added docstring clearly and succinctly describes purpose of the function.
* DRY, use the clone feature of Argument Clinic.
* Try to avoid adding new interned strings; reuse existing parameter names if possible. Use the `as` feature of Argument Clinic to override the C variable name, if needed.