Skip to content

Fix CI tests; drop 3.7; add 3.12, 3.14#13

Open
andrewrabert wants to merge 6 commits intogmr:masterfrom
andrewrabert:fix-ci
Open

Fix CI tests; drop 3.7; add 3.12, 3.14#13
andrewrabert wants to merge 6 commits intogmr:masterfrom
andrewrabert:fix-ci

Conversation

@andrewrabert
Copy link

@andrewrabert andrewrabert commented Feb 12, 2026

  • Fix compatibility with newer pycares
  • Dropped 3.7 due to flake8 incompatibility and asynctest not working with 3.14. I could try to work around that, but I figure 3.7 has been out of support since 2023 that it's not worth it.
  • Replaced asynctest with native async unittest (asynctest doesn't work with 3.14)
  • Added support through 3.14

Summary by CodeRabbit

  • Bug Fixes

    • MX TTL handling improved to ignore invalid TTLs and use a safe fallback.
  • Chores

    • Updated supported Python classifiers (removed 3.7; added 3.10–3.14).
    • Expanded CI testing matrix to include newer Python versions.
    • Made normalization entrypoint robust against existing event loop usage.
  • Tests

    • Modernized test suite to use native unittest async support and standard mocking.

pycares 4.x returns ttl=-1 for MX records, causing cache entries to
expire immediately. Treat negative TTL as unavailable and use
failure_ttl instead. TTL=0 is respected as a valid "do not cache"
signal for pycares 5.x compatibility.
@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Expanded CI Python matrix and package classifiers; removed asynctest from testing extras; modernized tests to use unittest.IsolatedAsyncioTestCase and unittest.mock; replaced module-level blocking event-loop usage with asyncio.run in normalize; adjusted MX-record TTL calculation to ignore negative TTLs and fall back to failure_ttl.

Changes

Cohort / File(s) Summary
CI workflow & packaging
\.github/workflows/testing.yaml, setup.cfg
Expanded GitHub Actions Python matrix to 3.83.14 (strings); removed Python 3.7 classifier and added 3.103.14; removed asynctest from [options.extras_require] testing.
Core async & MX logic
email_normalize/__init__.py
Replaced loop-based sync bridge with an inner async fn executed via asyncio.run() in module-level normalize; MX TTL computation now takes the minimum over non-negative TTLs, using failure_ttl if none; minor syntax cleanup.
Tests: async modernization
tests/test_normalize.py, tests/test_normalizer.py
Replaced asynctest usage with unittest.mock and unittest.IsolatedAsyncioTestCase; removed custom async test harness/decorator; tests now use native async def test methods and simplified cache/resolver setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from loops to asyncio.run,
New Python meadows, tests that hum,
TTLs now skip the negative crew,
CI stretches to versions new,
I nibble changes — then I’m done. 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the three main changes: fixing CI tests, dropping Python 3.7 support, and adding support for Python 3.12 and 3.14, which aligns with the changeset modifications across workflow configuration, setup.cfg, and test files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
.github/workflows/testing.yaml (1)

43-43: codecov/codecov-action@v1.0.2 is severely outdated and uses a deprecated Node.js runtime.

The latest version is v5.5.2. Upgrade to v5:

Show diff
-        uses: codecov/codecov-action@v1.0.2
+        uses: codecov/codecov-action@v5

Note: v4+ includes breaking changes related to tokenless uploading; review the migration notes when upgrading.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/testing.yaml (1)

22-22: ⚠️ Potential issue | 🟠 Major

actions/checkout@v1 is no longer functional on GitHub-hosted runners.

v1 uses the Node.js 12 runtime, which GitHub removed on August 14, 2023. Workflows using this version will fail. Current stable version is v4.3.1. The same applies to codecov/codecov-action@v1.0.2 on line 43 — current stable is v5.5.1. Both must be updated.

Proposed fix
-        uses: actions/checkout@v1
+        uses: actions/checkout@v4
-        uses: codecov/codecov-action@v1.0.2
+        uses: codecov/codecov-action@v5
🧹 Nitpick comments (2)
setup.cfg (1)

23-27: Python 3.10 and 3.11 are missing from classifiers and CI matrix.

The classifiers jump from 3.9 to 3.12, skipping 3.10 and 3.11. If this is intentional (e.g., untested), it's worth noting in the README/changelog. Otherwise, consider adding them for completeness—they are still widely used.

tests/test_normalizer.py (1)

22-30: Test relies on live DNS and is inherently racy.

test_mx_records makes two independent DNS queries to gmail.com — one via a standalone resolver (line 24) and one via self.normalizer (line 29). If the DNS responses differ (e.g., TTL-driven record rotation, different upstream resolvers), the assertion on line 28 will fail intermittently. This is a pre-existing pattern, but worth noting that it makes CI flaky in network-restricted or inconsistent DNS environments.

Consider mocking the resolver to make this test deterministic, or at minimum, document that this is an integration test requiring network access.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@setup.cfg`:
- Around line 26-30: The package classifiers in setup.cfg list Python versions
3.10, 3.11, and 3.13 but the CI testing matrix in .github/workflows/testing.yaml
only runs ['3.8','3.9','3.12','3.14'], causing a mismatch; fix by either
removing the unsupported classifier entries ("Programming Language :: Python ::
3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python
:: 3.13") from setup.cfg or add those versions to the CI matrix in testing.yaml
so the declared supported versions are actually tested.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/testing.yaml (1)

22-22: ⚠️ Potential issue | 🟡 Minor

actions/checkout@v1 is heavily outdated.

This version uses a deprecated Node.js runtime and will eventually stop working on GitHub-hosted runners. The current version is v6. Since this PR modernizes the CI matrix, consider bumping this as well.

Suggested fix
-        uses: actions/checkout@v1
+        uses: actions/checkout@v6
🧹 Nitpick comments (2)
.github/workflows/testing.yaml (2)

5-8: paths-ignore skips setup.* changes — dependency updates won't trigger CI.

Changes to setup.cfg (e.g., adding/removing test dependencies like replacing asynctest) won't trigger a test run when pushed alone. This is pre-existing but worth noting since this PR modifies test dependencies.


43-43: Upgrade codecov/codecov-action from v1.0.2 to v5.

v1.0.2 is heavily outdated (7+ years old). The current major version is v5 (latest v5.5.2 as of Dec 2025). Older versions use deprecated upload mechanisms and outdated Node.js runtimes.

Suggested fix
-        uses: codecov/codecov-action@v1.0.2
+        uses: codecov/codecov-action@v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant