Skip to content

Implement tests for singleton decorator#2107

Open
kivancbeser wants to merge 4 commits intoOpenMind:mainfrom
kivancbeser:main
Open

Implement tests for singleton decorator#2107
kivancbeser wants to merge 4 commits intoOpenMind:mainfrom
kivancbeser:main

Conversation

@kivancbeser
Copy link

Add tests for singleton decorator functionality including basic instance equality, reset behavior, and thread safety.

Overview

This PR adds comprehensive unit tests for the singleton decorator located in src/providers/singleton.py. While the core logic was partially covered by indirect usage, these dedicated tests ensure that the singleton pattern remains robust as the project grows.

Type of change

  • Bug fix
  • New feature
  • Documentation improvement
  • Bounty issue submission
  • Other: Test Coverage Improvement

Changes

  • Created tests/providers/test_singleton_provider.py.

  • Added test_singleton_basic_functionality to verify instance equality.

  • Added test_singleton_reset to verify the instance clearing mechanism.

  • Added test_singleton_thread_safety using the threading module to ensure the decorator is safe for concurrent access (race condition prevention).

Checklist

  • Code complies with style guidelines
  • Self-review completed
  • Documentation updated (if applicable)
  • Local testing completed
  • Tests added/updated (if applicable)

Impact

This change has no risk to the existing codebase as it only adds test files. It improves the reliability of the singleton utility, which is a foundational component used across various providers in OM1.

Additional Information

Local test results:
collected 3 items
tests/providers/test_singleton_provider.py ... [100%]
============================== 3 passed in 0.11s ==============================

Add tests for singleton decorator functionality including basic instance equality, reset behavior, and thread safety.
@kivancbeser kivancbeser requested a review from a team as a code owner February 4, 2026 21:31
@github-actions github-actions bot added python Python code tests Test files labels Feb 4, 2026
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@Wanbogang
Copy link
Collaborator

@kivancbeser
Please take a look and fix the test errors

@kivancbeser
Copy link
Author

@kivancbeser Please take a look and fix the test errors

Fixed

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

Labels

python Python code tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants