Add comprehensive testing infrastructure with Poetry#303
Open
llbbl wants to merge 1 commit into
Open
Conversation
- Set up Poetry as package manager with development dependencies - Add pytest, pytest-cov, and pytest-mock as testing dependencies - Configure pytest with custom markers (unit, integration, slow) - Configure coverage reporting with 80% threshold - Create tests directory structure (tests/unit, tests/integration) - Add comprehensive shared fixtures in conftest.py - Create validation tests to verify infrastructure setup - Update .gitignore with testing artifacts and Claude Code entries
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.
About UnitSeeker
Hi! This PR is part of the UnitSeeker project, a human-guided initiative to help Python repositories establish testing infrastructure.
Key points:
Learn more about the project and see the stats on our progress at https://unitseeker.llbbl.com/
Summary
This PR establishes a complete testing infrastructure for the xlsx2csv project using Poetry as the package manager. The setup provides a production-ready testing environment where developers can immediately start writing and running tests.
Changes Made
Package Management
pyproject.toml^3.9(required by latest pytest and coverage tools)Testing Dependencies
Added as development dependencies:
Testing Configuration
Configured in
pyproject.toml:pytest settings:
tests/directory@pytest.mark.unit- Unit tests@pytest.mark.integration- Integration tests@pytest.mark.slow- Long-running testsCoverage settings:
xlsx2csvmodulehtmlcov/directoryDirectory Structure
Shared Fixtures (conftest.py)
Provides ready-to-use fixtures:
temp_dir- Temporary directory with auto-cleanuptemp_file- Temporary file creationsample_csv_content- Sample CSV datasample_xlsx_path- Path to test XLSX filestest_data_dir- Access to existing test datareset_environment- Environment variable isolationmock_config- Mock configuration dictionarycapture_output- Output capture utilityValidation Tests
Created
test_infrastructure.pywith 14 tests that verify:All validation tests pass successfully.
Running Tests
Install dependencies
Run all tests
Run with verbose output
Run specific test categories
Run without coverage
Generate coverage report
poetry run pytest --cov=xlsx2csv --cov-report=html # Open htmlcov/index.html to view reportConfiguration Notes
Python Version
Coverage Threshold
[tool.pytest.ini_options]section ofpyproject.tomlCompatibility with Existing Tests
test/directory with XLSX/CSV test files remains unchangedtest/runscript continues to work as beforetests/directory is for pytest-based unit and integration testsNext Steps
The testing infrastructure is now ready for use. Developers can:
tests/unit/tests/integration/conftest.pypoetry run pytestFiles Modified
pyproject.toml- Added Poetry and testing configuration.gitignore- Added test artifacts and IDE exclusionsFiles Added
tests/__init__.pytests/conftest.pytests/test_infrastructure.pytests/unit/__init__.pytests/integration/__init__.pypoetry.lock- Dependency lock fileThank you for considering this contribution! The testing infrastructure is intentionally minimal and unopinionated, giving you full control over how to write tests for your codebase. Feel free to modify any configuration to better suit your project's needs.