evgenii-prusov opened a new pull request, #54548:
URL: https://github.com/apache/airflow/pull/54548

   This PR refactors the variable import tests in test_variable_command.py to 
improve maintainability, reduce code duplication, and increase test coverage.
   
   Changes:
   
   - Added reusable fixtures for test data (simple_variable_data, 
variable_data_with_descriptions, env_variable_data) and a factory fixture 
(create_variable_file) for creating test files in any format
   - Consolidated tests using parametrization:
       - `test_variables_import_formats` - Tests JSON, YAML, YML formats 
(replaced 3 separate tests)
       - `test_variables_import_with_descriptions` - Tests JSON, YAML with 
descriptions (replaced 2 tests)
       - `test_variables_import_action_on_existing` - Tests action flags for 
JSON, YAML, YML (added missing JSON coverage)
       - `test_variables_import_invalid_format` - Tests invalid files for all 
formats (added missing JSON coverage)
       - `test_variables_import_unsupported_format` - Tests unsupported file 
extensions
   - Improved test coverage by adding previously missing tests for JSON format 
with action_on_existing and invalid format scenarios
   - Reduced code duplication from ~8 individual tests to 5 parametrized tests
   
   Benefits:
   - Better maintainability through DRY principles
   - Consistent testing across all supported formats
   - Easier to add new formats or test cases
   - Clearer test intent through descriptive parametrized tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to