Fix mock content initialization in test fixtures#190
Closed
metaodi wants to merge 1 commit into
Closed
Conversation
This commit addresses test failures caused by mock objects being passed to XML parsing functions. The issue occurred when test fixture files couldn't be found, leaving response_mock.content uninitialized as a Mock object instead of bytes/string. Changes: 1. Initialize response_mock.content to empty string when no fixture file is found, preventing TypeError in XML parsing 2. Add fallback logic to handle fixture file naming mismatches between snake_case test method names and CamelCase fixture files 3. Implement case-insensitive fixture file lookup for backward compatibility 4. Fix black formatting issue in osmapi/OsmApi.py (add blank line after module docstring) 5. Update test_Capabilities_deprecation_warning to explicitly specify fixture file The fixture lookup now tries multiple strategies: - Exact filename match - Case-insensitive match - snake_case to CamelCase conversion (e.g., test_way_get.xml -> test_WayGet.xml) This fixes the test_Capabilities_deprecation_warning test and many other tests that were failing due to fixture file naming mismatches after the snake_case refactoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 commit addresses test failures caused by mock objects being passed to XML parsing functions. The issue occurred when test fixture files couldn't be found, leaving response_mock.content uninitialized as a Mock object instead of bytes/string.
Changes:
The fixture lookup now tries multiple strategies:
This fixes the test_Capabilities_deprecation_warning test and many other tests that were failing due to fixture file naming mismatches after the snake_case refactoring.
🤖 Generated with Claude Code