Skip to content

Conversation

@danfimov
Copy link
Contributor

@danfimov danfimov commented Oct 30, 2025

Fixes

Import from datetime import UTC is valid only with python version equal or higher 3.11 - docs.

Also type hint with str | None not working in python versions lower than 3.10, because PEP-604 was implemented in python 3.10.

So I fixed an import + type hint and added some basic tests to just calling code from this files and make sure that it works. I also added ruff rule FA102 to prevent this issues in future commits.

Mics

Update anyio version in poetry.lock to enable anyio_mode=auto in tests and get rid of pytest.mark.anyio decorators. They added this ability in last version - release notes (see 4.11.0)


Connected to this issue: danfimov/taskiq-dashboard#29

Copilot AI review requested due to automatic review settings October 30, 2025 10:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request upgrades the anyio dependency from version 3.x to 4.x and removes the @pytest.mark.anyio decorators from test files. The upgrade allows pytest-anyio to automatically detect and run async tests through the new anyio_mode = "auto" configuration in pyproject.toml. Additionally, the PR replaces the deprecated datetime.UTC with timezone.utc for Python 3.9+ compatibility.

Key changes:

  • Upgraded anyio from >=3 to >=4 (version 4.11.0 in lock file)
  • Added anyio_mode = "auto" to pytest configuration to enable automatic async test detection
  • Removed @pytest.mark.anyio decorators from all test files (decorator no longer needed with auto mode)
  • Changed datetime.UTC to timezone.utc in the middleware for broader Python compatibility

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Updated anyio dependency constraint to >=4 and added anyio_mode configuration for automatic async test detection
poetry.lock Updated lock file reflecting anyio upgrade from 4.9.0 to 4.11.0
taskiq/middlewares/taskiq_admin_middleware.py Replaced deprecated datetime.UTC import with timezone.utc for compatibility
tests/test_*.py (multiple files) Removed @pytest.mark.anyio decorators and pytest imports (no longer needed with auto mode)
tests/middlewares/test_taskiq_admin_middleware.py New test file with @pytest.mark.anyio decorators retained (uses pytest fixtures)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@danfimov danfimov force-pushed the fix-taskiq-admin-middleware branch from 494acf6 to a1d38c5 Compare October 30, 2025 10:54
@danfimov danfimov force-pushed the fix-taskiq-admin-middleware branch from a1d38c5 to 5183c9f Compare October 30, 2025 10:56
@danfimov danfimov force-pushed the fix-taskiq-admin-middleware branch from a874d19 to a6894fd Compare October 30, 2025 11:58
@s3rius s3rius merged commit 7c92e16 into taskiq-python:master Oct 30, 2025
33 checks passed
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.

2 participants