feat: Add comprehensive Python testing infrastructure with Poetry#451
Open
llbbl wants to merge 1 commit intoWikidata:masterfrom
Open
feat: Add comprehensive Python testing infrastructure with Poetry#451llbbl wants to merge 1 commit intoWikidata:masterfrom
llbbl wants to merge 1 commit intoWikidata:masterfrom
Conversation
- Set up Poetry for dependency management with pyproject.toml - Configure pytest with coverage reporting and custom markers - Create test directory structure (unit/integration) - Add comprehensive test fixtures in conftest.py - Include validation tests for infrastructure verification - Update .gitignore with testing artifacts - Add Makefile with convenient test commands
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.
Add Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the soweego Python project using modern Python testing tools and best practices. The setup provides a solid foundation for writing and maintaining tests going forward.
Changes Made
Package Management
pyproject.tomlwith Poetry as the package managerTesting Framework Setup
Pytest Configuration:
Coverage Configuration:
Directory Structure
Test Fixtures (conftest.py)
Created comprehensive fixtures for common testing needs:
temp_dir/temp_file: Temporary file system resourcesmock_config: Configuration dictionary for testingmock_database_session: SQLAlchemy session mockmock_http_client: HTTP client mock for API testingsample_entity_data: Wikidata entity test datacli_runner: Click CLI testing runnermock_wikidata_api: Wikidata API mocksample_csv_data/sample_json_data: Test data filesisolated_filesystem: Isolated test environmentmock_logger: Logger mock for testing logging behaviormock_sparql_results: SPARQL query result mocksAdditional Configuration
How to Use
Installation
Running Tests
Writing New Tests
tests/unit/tests/integration/conftest.pyfor common test needs@pytest.mark.unit,@pytest.mark.integration, or@pytest.mark.slowValidation
All infrastructure components have been validated with 18 passing tests that verify:
Notes
fail_under = 80lines inpyproject.toml.gitignoreto avoid dependency conflictsNext Steps