Skip to content

Fixed #36369: Added tests to verify FORWARD_PROPERTIES and REVERSE_PROPERTIES cache behaviours. #19645

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jrsenthil-kumar2312
Copy link

Trac ticket number
Ticket-36369

Branch description
What: This PR adds unit tests for FORWARD_PROPERTIES and REVERSE_PROPERTIES.

Why: Based on the discussions in this ticket and this #19245, it was obvious that unit tests were missing for FORWARD_PROPERTIES and REVERSE_PROPERTIES in models/options.py.

Main update: Introduced a new test file, test_meta_caching.py, containing unit tests focused on testing that the correct caches are expired when the interface to clear them (apps.clear_cache()) is called, specifically targeting REVERSE_PROPERTIES and FORWARD_PROPERTIES.

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.
[N/A] I have added or updated relevant docs, including release notes if applicable.
[N/A] I have attached screenshots in both light and dark modes for any UI changes.

except Exception as e:
self.fail(f"Failed to access cached property '{attr_name}': {e}")

opts._expire_cache()

Choose a reason for hiding this comment

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

There was a previous comment about avoiding internal functions, but unfortunately, I can’t use apps.clear_cache() — the tests fail because it doesn’t actually clear any caches when used.

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