Add unit tests for all provider plugins#1773
Merged
openminddev merged 40 commits intomainfrom Jan 20, 2026
Merged
Conversation
Added unit tests for ASRRTSPProvider, AvatarProvider, and ConfigProvider. Improved resource cleanup in AvatarProvider and ConfigProvider by undeclaring subscribers and publishers on stop. These changes enhance test coverage and ensure proper resource management.
Introduce unit tests for the ContextProvider class, covering initialization, singleton behavior, context updates, field setting, stopping, and error handling. Mocks are used for Zenoh session and publisher dependencies.
Updated the import statement in test_d435_provider.py to use the correct relative path for D435Provider. This resolves import errors when running tests.
Introduces unit tests for the FabricDataSubmitter, RFData, RFDataRaw, and FabricData classes. Tests cover singleton behavior, data serialization, API interaction (with and without API key), RF data handling, and local file writing.
Added logic to undeclare and clean up the avatar_healthcheck_publisher in the AvatarProvider shutdown process to prevent resource leaks.
Introduces unit tests for the GalleryIdentitiesProvider singleton behavior, lifecycle methods, callback registration, and identity fetching logic, as well as for the IdentitiesSnapshot's to_text method. These tests improve coverage and help ensure correct functionality.
Introduces tests for initialization, singleton behavior, exception handling, timestamp conversion, stopping, and data properties of the GpsProvider class. Uses pytest fixtures and mocking to isolate dependencies.
Introduce unit tests for the OdomProvider class and RobotState enum, covering initialization, singleton behavior, process/thread management, and position property. Mocks are used for multiprocessing and threading dependencies to isolate test logic.
Corrects the publisher close method from self._publisher.Close() to self.publisher_.Close() in ROS2PublisherProvider. Adds comprehensive unit tests for initialization, message handling, start/stop behavior, and message publishing.
Introduces tests for RPDriver initialization, device info retrieval, scan start, and stop functionality using unittest.mock to simulate serial communication.
Introduce unit tests for the RPLidarProvider and RPLidarConfig classes, covering configuration, singleton behavior, initialization, start/stop methods, and multiprocessing/threading interactions using mocks.
Changed the import of RtkProvider to use the correct module path. Also removed outdated comments about checksum validation in the test for invalid checksums.
Introduce unit tests for the TeleopsConversationProvider, including tests for enum values, message serialization, singleton behavior, API key handling, and message storing methods.
Refactored tests for storing user and robot messages to patch the executor's submit method, allowing for direct assertions on message content and type. Removed unnecessary sleep and assert statements for more precise and efficient testing.
Enhanced the test to assert that messages are correctly submitted with the expected content and message type when no API key is provided. This improves test coverage and ensures correct behavior of the message storing logic.
Adds a chained mock return value for readline().decode().strip() in the mock_serial fixture to ensure consistent behavior during testing.
Added more robust cleanup in test fixtures for GalleryIdentitiesProvider and GpsProvider by ensuring providers are stopped after tests. Enhanced GPS provider mock to set is_open and simplify readline return value.
Deleted the test_rplidar_provider.py test file and removed a redundant file header comment from gallery_identities_provider.py. This streamlines the codebase by eliminating unused tests and unnecessary comments.
Introduce comprehensive tests for RPLidarProvider and RPLidarConfig, covering initialization, singleton behavior, configuration defaults and overrides, path setup, Zenoh integration, angle blanking, and log file creation. External dependencies are mocked to isolate provider logic.
Introduced a stop() method in TeleopsStatusProvider to allow for resource cleanup by shutting down the executor. Added comprehensive unit tests for TeleopsStatusProvider and related data classes to ensure correct behavior and coverage.
Introduce unit tests for TurtleBot4CameraVideoStream and TurtleBot4CameraVLMProvider, covering initialization, singleton behavior, camera listener, and start/stop methods. Mocks are used for Zenoh and websocket dependencies to isolate test logic.
Introduce unit tests for the UbtechASRProvider, covering initialization, singleton behavior, callback registration, start/stop/pause/resume methods, language setting, and session header configuration. These tests help ensure correct provider behavior and improve code reliability.
Added a new test suite for UbtechCameraVideoStream covering initialization, callbacks, FPS, resolution, JPEG quality, URL formatting, and video stream start. Minor formatting and cleanup changes were made to test_ubtech_asr_provider.py for consistency.
Introduce comprehensive unit tests for the UbtechVLMProvider class, covering initialization, singleton behavior, message callback registration, start/stop logic, and video stream parameter handling. Mocks are used for external dependencies to isolate provider logic.
Introduce comprehensive unit tests for the UnitreeG1LocationsProvider class, covering initialization, singleton behavior, threading, HTTP fetch logic, error handling, and thread safety. These tests use pytest and unittest.mock to validate provider functionality and robustness.
Introduces a stop() method to UnitreeG1NavigationProvider for resource cleanup and proper shutdown. Adds comprehensive unit tests covering initialization, singleton behavior, dependency handling, and the new stop functionality.
Introduce unit tests for the UnitreeGo2AMCLProvider class, covering initialization, default values, singleton behavior, property access, and the start method. Zenoh dependencies are mocked to isolate provider logic.
Introduce unit tests covering initialization, singleton behavior, property accessors, and dependency mocking for UnitreeGo2FrontierExplorationProvider. These tests ensure correct instantiation, singleton enforcement, and integration with mocked dependencies.
Introduce unit tests covering initialization, singleton behavior, properties, and start method for UnitreeGo2LidarLocalizationProvider. Zenoh dependencies are mocked to isolate provider logic.
Introduce unit tests for the UnitreeGo2LocationsProvider class, covering initialization, default values, singleton behavior, and start/stop methods. Mocks are used for dependencies to isolate the provider logic.
Introduces a stop() method to UnitreeGo2NavigationProvider for resource cleanup and proper shutdown. Adds a new test suite covering initialization, default values, singleton behavior, and the start method.
Introduce comprehensive unit tests for the UnitreeGo2StateProvider class, covering initialization, singleton behavior, start/stop logic, state values, and dependency mocking. These tests help ensure correct provider behavior and improve code reliability.
Introduce comprehensive unit tests for UnitreeRealSenseDevVLMProvider and UnitreeRealSenseDevVideoStream, covering initialization, singleton behavior, callback registration, start/stop logic, and parameter passing. These tests use pytest and unittest.mock to ensure correct functionality and integration.
Introduces unit tests for the VLMOpenAIRTSPProvider class, covering initialization, singleton behavior, frame queuing, message callback registration, and dependency injection. These tests improve reliability and ensure correct behavior of provider configuration and interactions.
Introduces unit tests for the VLMVilaRTSPProvider class, covering initialization, singleton behavior, callback registration, start/stop functionality, and custom configuration options. Mocks dependencies to isolate provider logic and ensure correct interactions.
Introduce unit tests for the VLMVilaZenohProvider class, covering initialization, singleton behavior, callback registration, start/stop logic, and configuration options. Mocks are used for dependencies to isolate provider logic.
Introduces unit tests for ZenohListenerProvider covering initialization, callback registration, start/stop behavior, and error handling to ensure correct functionality and robustness.
Introduces unit tests for ZenohPublisherProvider covering initialization, message queuing, publishing, thread management, and message formatting. These tests improve reliability and ensure correct behavior under various scenarios.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new
stopmethods to several provider classes for improved resource management and adds comprehensive unit tests for multiple providers. The most important changes are grouped below by theme.Resource cleanup and provider lifecycle improvements:
stopmethod toTeleopsStatusProviderto properly shut down its executor and clean up resources.stopmethods to bothUnitreeG1NavigationProviderandUnitreeGo2NavigationProviderto close sessions, undeclare publishers, and update running state for safe shutdown. [1] [2]Testing improvements and coverage:
RPLidarProviderintest_rplidar_provider.py, including singleton reset logic and mocking of dependencies.TeleopsStatusProviderand related data classes intest_teleops_status_provider.py, covering creation, serialization, deserialization, and singleton behavior.TurtleBot4CameraVLMProviderandTurtleBot4CameraVideoStreamintest_turtlebot4_camera_vlm_provider.py, including Zenoh session mocking, initialization, lifecycle, and singleton enforcement.