Skip to content

Fixed #35986 -- Fixed test classes with @translation.override decorator. #19358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

AhmedNassar7
Copy link
Contributor

Trac ticket number

ticket-35986

Branch description

Replace class-level @translation.override decorator with enterClassContext() in
test classes. This ensures proper test discovery and execution of test classes
using translation overrides.

Changes made:

  • Updated test classes to use enterClassContext() instead of decorator
  • Fixed test discovery for timezone-related test classes
  • Ensures consistent behavior across test runners

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@sarahboyce sarahboyce changed the title Fixed #35986 -- Fixed test classes with @translation.override decorator Fixed #35986 -- Fixed test classes with @translation.override decorator. Apr 8, 2025
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

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

Thank you! This looks good to me

@sarahboyce sarahboyce merged commit 522dd02 into django:main Apr 9, 2025
20 checks passed
@@ -31,7 +31,7 @@ def utc(value):
"""
Convert a datetime to UTC.
"""
return do_timezone(value, datetime.UTC)
return do_timezone(value, UTC)
Copy link
Member

Choose a reason for hiding this comment

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

This is a fix for regression in efb7f9c, not related with this patch.

Copy link
Member

Choose a reason for hiding this comment

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

It seems that we don't have tests for the utc filter 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

It did start to fail with these changes as some tests started to "run" which were not running before
But you're right it should have been two commits

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.

3 participants