chore(test): migrate unit tests to follow the new test layout#925
Draft
Bodong-Yang wants to merge 2 commits intomainfrom
Draft
chore(test): migrate unit tests to follow the new test layout#925Bodong-Yang wants to merge 2 commits intomainfrom
Bodong-Yang wants to merge 2 commits intomainfrom
Conversation
Move 26 unit-tier test files from tests/ to test/unit/, mirroring the src/ package layout per MIGRATION_PLAN.md Phase 1. Mock targets re- pointed at current src/ module paths (no legacy otaclient.app.*), unittest.mock usages converted to pytest-mock's mocker, and duplicated case bodies parametrized. Conftest scoping per the plan: only the genuinely shared ota_status_collector fixture lives at test/conftest.py; mock_ensure_mount, mock_ensure_umount, mock_certs_dir, and the fstrim_at_subprocess silencer are scoped to test/unit/test_otaclient/test_ota_core/conftest.py since they only matter inside the ota_core subsystem. Also: extlinux text fixtures relocated to test/data/ (referenced via Path(__file__).parents[3] / "data"); compare_message extracted to a local _compare.py helper under test_otaclient_api/test_v2/ and inlined in the proto_wrapper test to keep that subtree self-contained; test_detect_ota_image_spec.py rewritten as a true unit test with a mocked downloader (the legacy version implicitly relied on session- autouse HTTP server fixtures). All 679 unit tests pass under the docker-based suite (1 skipped). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Contributor
📊 OTA Update Performance Comparison Report
⏱️ Execution Time
|
|
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.



Introduction
Note
This PR is one of the PR from a PR set that does the full migration.
This PR migrates the tests that can be categorized into unit tests to the
test/unitfolder as follow:test_logging,test_typing,test_shm,test_retry_task_map,test_log_setting,test_cfg_configurable,test_cfg_consts,test_firmware_package,test_metadata_jwt, and the fourproto_wrapperexample files (example.proto,example_pb2.py,example_pb2.pyi,example_pb2_wrapper.py)mockerconversion, similarity 57–99%)test_base(R057),test_metadata(R062),test_main(R068),test_download_bsp_version_file(R080),test_proto_wrapper(R082),test_nvidia_jetson_check_bsp(R085),test_ipc_interface(R092),test_utils(R094),test_jetson_common(R095),test_jetson_uefi(R095),test_status_monitor(R096),test_api_caller(R099),test_pb2_compat(R099)test/conftest.py,test/unit/test_otaclient/test_ota_core/conftest.py,test/unit/test_otaclient_api/test_v2/_compare.py, four extlinux fixtures undertest/data/, rewritten unit teststest_detect_ota_image_spec.py,test_grpc/test_api_v2/test_main.py,test_otaclient_common/test_cmdhelper.py, plus required__init__.pyfilestests/test_otaclient_common/test_cmdhelper.py,tests/test_otaclient_api/test_v2/test_types.py,tests/test_ota_metadata/test_detect_ota_image_spec.py,tests/test_otaclient/test_grpc/test_api_v2/test_main.py,tests/test_otaclient_common/test_proto_wrapper/__init__.py