Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Jan 19, 2026

Overview

This pull request is focusing on the introduction of warnings regarding Python 3.15 compatibility, enhancement of existing test stability, and prevention of potential errors in memory-related tests.

Warnings for Python 3.15 enum Behavior Changes

To address the upcoming changes in IntFlag handling in Python 3.15, introducing a FutureWarning to proactively notify users of potential behavioral shifts.
An initial explanation of this change has also been added to README.md.

Test Assertions in test_puredispatch.py

In test_puredispatch.py, test assertions for the ProductState property now directly use module-level constants.
This is a measure to avoid being affected by the reinterpretation of IntFlag in Python 3.15.

Skipping Tests in Python 3.15 Alpha/Beta

To prevent CI failures caused by known but unfinalized changes in Python 3.15's alpha and beta versions, specific tests related to enum behavior are now conditionally skipped.
This allows the CI pipeline to remain green, preventing new, unrelated bugs from being obscured.
This skipping mechanism is intended as a temporary measure until Python 3.15 reaches a Release Candidate (RC) stage, at which point these tests will be unskipped to ensure full compatibility validation for the final release.

Ensuring Memory Safety in from_outparam Tests

The test_outparam module has been updated to prevent potential memory-related inconsistency.
By using create_unicode_buffer, the tests can safely verify the behavior of from_outparam on memory outside of the COM allocator's control.

Explain that `IntFlag` values for negative enum members may be reinterpreted
in Python 3.15+, affecting `comtypes` generated enums.
Introduces a `FutureWarning` in `__init__.py` for Python 3.15 and later to
notify users about potential changes in `enum` handling, specifically
`IntFlag` values.
Conditionally skip `test_enums_in_friendly_mod` on Python 3.15 alpha/beta
versions in `test_client.py` to prevent failures due to
potential `IntFlag` changes. This change includes adding `subTest` messages
for better debugging.

Additionally, refactor enum member access in `test_puredispatch.py`
from `msi.MsiInstallState.msiInstallStateUnknown` to
`msi.msiInstallStateUnknown` for improved clarity and consistency.
The test now uses `create_unicode_buffer` to safely allocate a valid
memory block outside of the COM allocator's control. This ensures
the test correctly validates the behavior of `from_outparam` on
unmanaged memory without causing access violations.
@junkmd junkmd added tests enhance or fix tests shared_info use cases, tips and troubleshoots labels Jan 19, 2026
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.24%. Comparing base (1fc72e0) to head (82b8d54).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
comtypes/__init__.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #907      +/-   ##
==========================================
- Coverage   86.26%   86.24%   -0.02%     
==========================================
  Files         132      132              
  Lines       12326    12334       +8     
==========================================
+ Hits        10633    10638       +5     
- Misses       1693     1696       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@junkmd junkmd merged commit 7008819 into enthought:main Jan 19, 2026
81 of 101 checks passed
@junkmd junkmd deleted the test_stability_enum_outparam_etc branch January 19, 2026 12:55
@junkmd junkmd added this to the 1.4.15 milestone Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shared_info use cases, tips and troubleshoots tests enhance or fix tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant