Refactor tests#35
Draft
chaen wants to merge 5 commits into
Draft
Conversation
This commit consolidates all shared test fixtures, constants, and utilities into a single root conftest.py file, reducing code duplication across the tests/, benchmark_tests/, and profiling_tests/ directories. Changes: - Created root conftest.py with all shared fixtures: - Server fixtures: moto_server, rustfs_server, minio_server, seaweedfs_server - Test infrastructure: pytest_addoption, test_results_dir - Timing utilities: _timeit, _timeit_async, _timeit_async_helper - Constants: BUCKET_NAME, OTHER_BUCKET_NAME, MISSING_BUCKET_NAME, etc. - Utility functions: random_file, b16_to_b64 - Client fixtures: s3_clients, s3_clients_aio - Updated subdirectory conftest.py files to re-export from root: - tests/conftest.py: re-exports constants and utilities for test imports - benchmark_tests/conftest.py: re-exports constants, utilities, and timing functions - profiling_tests/conftest.py: re-exports test infrastructure - Added __init__.py files to tests/, benchmark_tests/, profiling_tests/ to make them proper Python packages, ensuring relative imports work correctly - Updated benchmark test files to use correct import paths Benefits: - Single source of truth for all shared fixtures - Changes to server setup affect all test types consistently - Reduced maintenance burden - Eliminated duplicate rustfs_server fixture definition - All 260 tests continue to collect and work correctly Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…rametrized file IMPLEMENTATION: - Created 20 operation-specific runner functions (10 sync, 10 async) - Each runner handles: setup, warmup, benchmark execution, cleanup - 2 parametrized test functions generate all 40 test cases: * test_benchmark_sync: 10 operations x 2 client patterns (plain, CM) * test_benchmark_async: 10 operations x 2 client patterns (plain, CM) - Operations: generate_presigned_post, generate_presigned_url, head_bucket, head_object, create_bucket, delete_objects, put_object, list_objects, copy_object, upload_file BENEFITS: - Single source of truth for benchmark logic - Adding new operations: add 2 runner functions - Adding new modes: add parametrize values - Consistent test structure across all benchmarks - Easier maintenance and bug fixes Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…to test_clients.py IMPLEMENTATION: - Consolidated both sync and async unit tests into a single file - Sync tests use s3_clients fixture (Client) - Async tests use s3_clients_aio fixture (AsyncClient) - Different bucket names for async tests to avoid conflicts - Botocore exception handling: sync uses ClientError, async uses errorfactory.ClientError OPERATIONS TESTED (sync + async variants): - create_bucket, head_bucket (exists/not_found) - head_object (exists/not_found/missing_key/missing_bucket) - generate_presigned_post, generate_presigned_url - put_object (basic/metadata/missing_bucket/missing_key) - list_objects (empty/with_results/with_delimiter/missing_bucket) - copy_object (string_source/dict_source/missing_bucket/missing_source) - upload_file (basic/extra_args/acl_extra_args/missing_file) - delete_objects (basic/quiet/missing_bucket/missing_objects) BENEFITS: - Single file for all unit tests (easier navigation and maintenance) - Consistent test patterns across sync and async - All tests still collected and working - Reduced file count from 2 to 1 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Registers the 'moto' mark used in parametrized tests that only run with the moto server backend. This eliminates the PytestUnknownMarkWarning that appeared after consolidating test files in Phase 3. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
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.
No description provided.