Skip to content

gh-103092: Test _ctypes type hierarchy and features - #113727

Merged
erlend-aasland merged 16 commits into
python:mainfrom
aisk:more-ctypes-tests
Jan 9, 2024
Merged

gh-103092: Test _ctypes type hierarchy and features#113727
erlend-aasland merged 16 commits into
python:mainfrom
aisk:more-ctypes-tests

Conversation

@aisk

@aiskaisk commented Jan 5, 2024

Copy link
Copy Markdown
Member

This change is related to #113620 (review), to test the compatibility before and after it.

All classes with metatypes (which have changed in #113620) are tested, plus CField. Other classes are hard to test (can't be accessed in Python easily), or Windows related (I'm not using Windows now), I think it's better to add tests to test them in another PR.

@erlend-aasland

@bedevere-appbedevere-appBot added tests Tests in the Lib/test dir awaiting review labels Jan 5, 2024
@bedevere-appbedevere-appBot mentioned this pull request Jan 5, 2024
25 tasks
Comment threadLib/test/test_ctypes/test_struct_fields.py Outdated
Comment threadLib/test/test_ctypes/test_unions.py Outdated
@erlend-aaslanderlend-aasland changed the title gh-103092: add tests for ctypes to maintain compatibility after isolating itgh-103092: Tests _ctypes type hierarchy and featuresJan 6, 2024
Comment threadLib/test/test_ctypes/test_arrays.py Outdated
Comment threadLib/test/test_ctypes/test_arrays.py Outdated
Comment threadLib/test/test_ctypes/support.py Outdated
Comment threadLib/test/test_ctypes/test_arrays.py Outdated
Comment threadLib/test/test_ctypes/test_struct_fields.py Outdated
@aisk

aisk commented Jan 9, 2024

Copy link
Copy Markdown
MemberAuthor

Thanks for the review. All issues mentioned in the comments above should now be fixed.

And I renamed support.py to _support.py, otherwise it will cause an ambiguous import when running with -R : argument:

Traceback (most recent call last):
File "C:\Users\xxxxx\Source\cpython\Lib\unittest\loader.py", line 113, in loadTestsFromModule
return load_tests(self, tests, pattern)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxxx\Source\cpython\Lib\test\test_ctypes\__init__.py", line 10, in load_tests
return support.load_package_tests(os.path.dirname(__file__), *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'test.test_ctypes.support' has no attribute 'load_package_tests'

@aisk

aisk commented Jan 9, 2024

Copy link
Copy Markdown
MemberAuthor

Lots of CIs have failed, seems to be related to GitHub's internal error, and this page often returns 500. I think we should re-run the CI after GitHub fixes the server error.

Comment threadLib/test/test_ctypes/test_arrays.py Outdated
aiskand others added 2 commits January 9, 2024 22:48
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
@erlend-aaslanderlend-aasland changed the title gh-103092: Tests _ctypes type hierarchy and featuresgh-103092: Test _ctypes type hierarchy and featuresJan 9, 2024
@erlend-aasland
erlend-aasland merged commit be89ee5 into python:mainJan 9, 2024
@aisk
aisk deleted the more-ctypes-tests branch January 9, 2024 17:31
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
)
Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name
The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
aisk added a commit to aisk/cpython that referenced this pull request Feb 11, 2024
)
Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name
The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
)
Test the following features for _ctypes types:
- disallow instantiation
- inheritance (MRO)
- immutability
- type name
The following _ctypes types are tested:
- Array
- CField
- COMError
- PyCArrayType
- PyCFuncPtrType
- PyCPointerType
- PyCSimpleType
- PyCStructType
- Structure
- Union
- UnionType
- _CFuncPtr
- _Pointer
- _SimpleCData
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
encukou pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2024
This partially backports be89ee5
(python#113727)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
encukou pushed a commit that referenced this pull request Oct 29, 2024
…on of `ctypes` and metaclasses. (GH-125881) (GH-125988)
cherry picked from commit 1384409
by Jun Komoda
Also: Add test_ctypes/_support.py from 3.13+
This partially backports be89ee5
(#113727)
by AN Long
Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@aisk@erlend-aasland