Skip to content

#737 Updates for Python 3.14 - #738

Merged
adiroiban merged 4 commits into
masterfrom
737-python-3.14-update
Aug 19, 2026
Merged

#737 Updates for Python 3.14 #738
adiroiban merged 4 commits into
masterfrom
737-python-3.14-update

Conversation

@adiroiban

@adiroiban adiroiban commented Jul 30, 2026

Copy link
Copy Markdown
Member

Scope

Fixes #737

These are the updates to get compat working on Python 3.14

Changes

Use latest pythia from chevah/pythia#77 ... which depends on this branch

Fix assertion that are introduces now in stdlib

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@@ -204,22 +203,6 @@ def assertTextContains(self, pattern, source):
message = f'{pattern!r} not contained in\n{source!r}.'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Removing assertStartsWith/assertEndsWith breaks Python < 3.13.2

assertion.py deletes the custom assertStartsWith/assertEndsWith from AssertionMixin, and all call sites were re-ordered to match the stdlib signature (s, prefix). But unittest.TestCase.assertStartsWith/assertEndsWith only exist in Python 3.13.2+/3.14, while pyproject.toml still declares requires-python = "~=3.8". On any supported interpreter below 3.13.2 these calls raise AttributeError — breaking this repo's own test suite and any downstream project that uses the public ChevahTestCase/AssertionMixin helpers. Either keep the custom methods (with the new (source, prefix) order) or bump requires-python to >=3.13.2 to match the actual supported range.

Was this helpful? React with 👍 / 👎

Comment thread pythia.conf
Comment thread pythia.conf
Comment thread src/chevah_compat/testing/assertion.py
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Comments Outside Diff (1)

  1. src/chevah_compat/testing/assertion.py, line 198-204 (link)

    P1 assertTextContains always passes — checks pattern against itself

    This is a pre-existing bug not introduced by this PR, but worth noting: the condition on line 202 reads if pattern not in pattern:, which is always False because a non-empty string always contains itself. The assertion never raises, so it provides no actual coverage guarantee. The condition should read if pattern not in source:. Was this pre-existing bug noticed during this pass? It's not introduced by the current diff but could be fixed opportunistically here.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/chevah_compat/testing/assertion.py
    Line: 198-204
    
    Comment:
    **`assertTextContains` always passes — checks `pattern` against itself**
    
    This is a pre-existing bug not introduced by this PR, but worth noting: the condition on line 202 reads `if pattern not in pattern:`, which is always `False` because a non-empty string always contains itself. The assertion never raises, so it provides no actual coverage guarantee. The condition should read `if pattern not in source:`. Was this pre-existing bug noticed during this pass? It's not introduced by the current diff but could be fixed opportunistically here.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Prompt To Fix All With AI
### Issue 1
pythia.conf:6-9
**Stale comment and redundant testing entry**

The comment on line 6 still reads "Use our production server instead of the GitHub releases set by default" but the active `BINARY_DIST_URI` now points to `/testing`. Additionally, line 9 is a commented-out entry that is identical to the now-active line 7 — so the "last uncommented instance wins" escape hatch described by the comment on line 8 is now a no-op duplicate. If this is intentional (Python 3.14 binaries not yet promoted to production), the comment on line 6 should be updated to reflect that, and the redundant line 9 should either be removed or restored to the original `/production` URL so there is still a reference to roll back to.

### Issue 2
src/chevah_compat/testing/assertion.py:198-204
**`assertTextContains` always passes — checks `pattern` against itself**

This is a pre-existing bug not introduced by this PR, but worth noting: the condition on line 202 reads `if pattern not in pattern:`, which is always `False` because a non-empty string always contains itself. The assertion never raises, so it provides no actual coverage guarantee. The condition should read `if pattern not in source:`.

### Issue 3
src/chevah_compat/testing/assertion.py:203-204
**`assertStartsWith` / `assertEndsWith` now rely solely on Python 3.14 stdlib**

Removing these methods from `AssertionMixin` means callers depend entirely on `unittest.TestCase.assertStartsWith` / `assertEndsWith`, which were added in Python 3.14. Any environment running Python ≤ 3.13 will now get `AttributeError` on every call site. If the library is expected to remain compatible with older Python versions (e.g., CI matrix still covers 3.12), these removals are premature. If 3.14 is now the minimum, a `python_requires` guard in `pyproject.toml` would make this intent explicit.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Use testing mirror." | Re-trigger Greptile

@gitar-bot

gitar-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 resolved / 2 findings

Updates test helpers and dependencies for Python 3.14 compatibility, but removing assertStartsWith and assertEndsWith breaks Python versions below 3.13.2.

⚠️ Bug: Removing assertStartsWith/assertEndsWith breaks Python < 3.13.2

📄 src/chevah_compat/testing/assertion.py:203-217 📄 pyproject.toml:16

assertion.py deletes the custom assertStartsWith/assertEndsWith from AssertionMixin, and all call sites were re-ordered to match the stdlib signature (s, prefix). But unittest.TestCase.assertStartsWith/assertEndsWith only exist in Python 3.13.2+/3.14, while pyproject.toml still declares requires-python = "~=3.8". On any supported interpreter below 3.13.2 these calls raise AttributeError — breaking this repo's own test suite and any downstream project that uses the public ChevahTestCase/AssertionMixin helpers. Either keep the custom methods (with the new (source, prefix) order) or bump requires-python to >=3.13.2 to match the actual supported range.

💡 Quality: pythia.conf points BINARY_DIST_URI at testing mirror

📄 pythia.conf:6-9

BINARY_DIST_URI was switched from /production to /testing (commit "Use testing mirror"), yet the adjacent comment still says "Use our production server" and the intended toggle is the commented #BINARY_DIST_URI=.../testing line below. This looks like a temporary testing change that should not be merged to master; releasing with the testing mirror can pull unstable binaries. Revert to /production before merge (or leave the dedicated commented testing line as the toggle).

🤖 Prompt for agents
Code Review: Updates test helpers and dependencies for Python 3.14 compatibility, but removing assertStartsWith and assertEndsWith breaks Python versions below 3.13.2.

1. ⚠️ Bug: Removing assertStartsWith/assertEndsWith breaks Python < 3.13.2
   Files: src/chevah_compat/testing/assertion.py:203-217, pyproject.toml:16

   assertion.py deletes the custom `assertStartsWith`/`assertEndsWith` from AssertionMixin, and all call sites were re-ordered to match the stdlib signature `(s, prefix)`. But `unittest.TestCase.assertStartsWith`/`assertEndsWith` only exist in Python 3.13.2+/3.14, while `pyproject.toml` still declares `requires-python = "~=3.8"`. On any supported interpreter below 3.13.2 these calls raise AttributeError — breaking this repo's own test suite and any downstream project that uses the public `ChevahTestCase`/`AssertionMixin` helpers. Either keep the custom methods (with the new `(source, prefix)` order) or bump `requires-python` to `>=3.13.2` to match the actual supported range.

2. 💡 Quality: pythia.conf points BINARY_DIST_URI at testing mirror
   Files: pythia.conf:6-9

   BINARY_DIST_URI was switched from `/production` to `/testing` (commit "Use testing mirror"), yet the adjacent comment still says "Use our production server" and the intended toggle is the commented `#BINARY_DIST_URI=.../testing` line below. This looks like a temporary testing change that should not be merged to master; releasing with the testing mirror can pull unstable binaries. Revert to `/production` before merge (or leave the dedicated commented testing line as the toggle).

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "Reformat." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates chevah-compat for Python 3.14.

Changes:

  • Upgrades Python and development dependencies.
  • Adopts Python 3.14 assertion APIs and removes six.text_type usage.
  • Bumps the release to 1.8.0.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pythia.conf Selects Python 3.14.
pyproject.toml Bumps version and development dependencies.
release-notes.rst Documents Python 3.14 support.
src/chevah_compat/testing/assertion.py Removes legacy assertion helpers and six conversion.
src/chevah_compat/testing/testcase.py Changes inheritance order and assertion usage.
src/chevah_compat/tests/normal/testing/test_mockup.py Updates assertion argument order.
src/chevah_compat/tests/normal/testing/test_assertion.py Updates assertion argument order.
src/chevah_compat/tests/normal/test_filesystem.py Updates assertion argument order.
src/chevah_compat/tests/elevated/test_capabilities.py Updates assertion argument order.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



class ChevahTestCase(TwistedTestCase, AssertionMixin):
class ChevahTestCase(AssertionMixin, TwistedTestCase):
@adiroiban
adiroiban merged commit ca5520c into master Aug 19, 2026
16 checks passed
@adiroiban
adiroiban deleted the 737-python-3.14-update branch August 19, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to Python 3.14

3 participants