Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more C API tests #111495

Open
9 of 10 tasks
serhiy-storchaka opened this issue Oct 30, 2023 · 16 comments
Open
9 of 10 tasks

Add more C API tests #111495

serhiy-storchaka opened this issue Oct 30, 2023 · 16 comments
Assignees
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes tests Tests in the Lib/test dir topic-C-API

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Oct 30, 2023

  • Add tests for PyBytes C API
  • Add tests for PyByteArray C API
  • Add tests for PyFloat C API
  • Add tests for PyComplex C API
  • Add tests for PyLong C API
  • Add tests for PyNumber C API
  • Add tests for PyTuple C API
  • Add tests for PyList C API
  • Add tests for PyCodec C API
  • Add tests for PyFile C API

Linked PRs

@serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir topic-C-API 3.12 bugs and security fixes 3.13 bugs and security fixes labels Oct 30, 2023
@serhiy-storchaka serhiy-storchaka self-assigned this Oct 30, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 30, 2023
@skirpichev
Copy link
Member

@serhiy-storchaka, initial set of C API tests for PyComplex (only for changed functions) was added in #109647

@serhiy-storchaka
Copy link
Member Author

Yes, there are also some tests for PyLong and PyNumber, and maybe other parts of the C API. But we should test the full C API, or at least document what is not tested. And it is better to group tests by the prefix, so it is clear where to find tests.

@serhiy-storchaka
Copy link
Member Author

If you want to work on adding tests to the part of the C API, say it here to avoid duplicating the work of other people. I finished work on PyBytes and PyByteArray and am not currently working on any of the above.

@skirpichev
Copy link
Member

@serhiy-storchaka, I will factor out tests PyComplex_RealAsDouble/ImagAsDouble from #109647 and tests for other functions for PyComplexType. (BTW, in #111496 I don't see actual tests, only interfaces. Tests in my pr were modeled from pack/unpack tests in test_float.py.)

@serhiy-storchaka
Copy link
Member Author

Good catch, @skirpichev. I forgot to add the actual test files.

@rawwar
Copy link
Contributor

rawwar commented Oct 31, 2023

@serhiy-storchaka , I would like to contribute tests to PyTuple and PyList C API

@serhiy-storchaka
Copy link
Member Author

@serhiy-storchaka , I would like to contribute tests to PyTuple and PyList C API

Great. Look at existing PySequence tests in Lib/test/test_capi/test_abstract.py. Some PyTuple and PyList tests can be a copy of PySequence tests. Look also at PyDict and PySet tests.

@skirpichev
Copy link
Member

skirpichev commented Nov 1, 2023

With multiple prs, Modules/Setup.stdlib.in will produce merge conflicts. (I already have fixed this a lot in #109647.) I will create a pr to add stub files for testing modules.

Edit:
#111586 - stub files for test modules
#111591 - tests for PyComplex C API on top of #111586

Then I'll add missing tests for PyFloat's C API.

skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 1, 2023
This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 1, 2023
This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 1, 2023
@serhiy-storchaka
Copy link
Member Author

I will create a pr to add stub files for testing modules.

Good idea!

serhiy-storchaka pushed a commit that referenced this issue Nov 1, 2023
This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 1, 2023
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 1, 2023
…GH-111586)

This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
(cherry picked from commit 33ed5fa)

Co-authored-by: Sergey B Kirpichev <[email protected]>
serhiy-storchaka pushed a commit that referenced this issue Nov 1, 2023
…H-111592)

This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
(cherry picked from commit 33ed5fa)
@sobolevn
Copy link
Member

sobolevn commented Nov 1, 2023

I am working on PyFile_ tests.

@picnixz
Copy link
Contributor

picnixz commented Aug 26, 2024

I've updated the bullet point list. Out of the remaining tasks, there is only the Codec API that needs to have more tests. The PyNumber and PyFile API seem to have PRs (I didn't check whether they are up-to-date or not). Can I work on the Codec API? (I've never added tests to the C API so I want to learn it with this)

@picnixz picnixz added the 3.14 new features, bugs and security fixes label Aug 26, 2024
@vstinner
Copy link
Member

The PyNumber and PyFile API seem to have PRs (I didn't check whether they are up-to-date or not).

I just merged the PyNumber PR.

Can I work on the Codec API? (I've never added tests to the C API so I want to learn it with this)

You can go ahead.

vstinner added a commit to vstinner/cpython that referenced this issue Aug 26, 2024
The suggestion for "print >> value" was removed recently:
commit 9375b9c.
vstinner added a commit that referenced this issue Aug 26, 2024
The suggestion for "print >> value" was removed recently:
commit 9375b9c.
skirpichev added a commit to skirpichev/cpython that referenced this issue Aug 27, 2024
(cherry picked from commit dbc1752)

Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: kalyanr <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 27, 2024
(cherry picked from commit 2f20f5a)

Co-authored-by: Sergey B Kirpichev <[email protected]>
skirpichev added a commit to skirpichev/cpython that referenced this issue Aug 27, 2024
(cherry picked from commit 2f20f5a)

Co-authored-by: Sergey B Kirpichev <[email protected]>
skirpichev added a commit to skirpichev/cpython that referenced this issue Aug 27, 2024
(cherry picked from commit dbc1752)

Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: kalyanr <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
serhiy-storchaka added a commit that referenced this issue Aug 27, 2024
(cherry picked from commit dbc1752)

Co-authored-by: kalyanr <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Yhg1s pushed a commit that referenced this issue Sep 2, 2024
gh-111495: Add tests for PyNumber C API (GH-111996)
(cherry picked from commit 2f20f5a)

Co-authored-by: Sergey B Kirpichev <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
This is to reduce merge conflicts (Modules/Setup.stdlib.in) for
subsequent pull requests for the issue.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Signed-off-by: kalyanr <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Sep 5, 2024
(cherry picked from commit dbc1752)

Co-authored-by: kalyanr <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vstinner pushed a commit that referenced this issue Sep 5, 2024
encukou pushed a commit that referenced this issue Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes tests Tests in the Lib/test dir topic-C-API
Projects
None yet
Development

No branches or pull requests

6 participants