Set up Python testing infrastructure with Poetry and pytest#97
Open
llbbl wants to merge 1 commit intoCaoZ:browserfrom
Open
Set up Python testing infrastructure with Poetry and pytest#97llbbl wants to merge 1 commit intoCaoZ:browserfrom
llbbl wants to merge 1 commit intoCaoZ:browserfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Set up comprehensive pytest configuration with coverage reporting - Create test directory structure with unit/integration separation - Add shared fixtures in conftest.py for common test patterns - Configure custom test markers (unit, integration, slow) - Add Poetry scripts for running tests (poetry run test/tests) - Update .gitignore with testing artifacts - Include validation tests to verify infrastructure setup
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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and maintaining tests with proper organization, coverage reporting, and development tooling.
Changes Made
Package Management
pyproject.tomlrequirements.txtto PoetryTesting Framework
Project Structure
Configuration Details
pytest Configuration (in pyproject.toml)
unit,integration,slowShared Fixtures (conftest.py)
temp_dir: Temporary directory for test filesmock_config: Mock configuration objectmock_config_file: Temporary config file creationmock_browser: Mock browser object for UI testingmock_requests_session: Mock HTTP sessionsample_htmlandmock_pyquery: HTML testing utilitiesreset_environment: Environment variable isolationcapture_logs: Log capture for testingDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative command (both work)Testing the Infrastructure
The setup includes validation tests that verify:
Run the validation tests:
poetry install poetry run testNotes
PyQt5 Dependency: Due to platform-specific installation issues on Linux, PyQt5 has been moved to an optional dependency group. Install with GUI support using:
Coverage Threshold: The coverage threshold is temporarily set to 0% to allow the validation tests to pass. This should be changed to 80% (as noted in the TODO comment) once actual unit tests are added.
No Production Code Tests: This PR only sets up the testing infrastructure. Actual unit and integration tests for the application code should be added in subsequent PRs.
Next Steps
pyproject.toml