feat: Set up comprehensive Python testing infrastructure with Poetry#68
Open
llbbl wants to merge 1 commit intodcramer:masterfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#68llbbl wants to merge 1 commit intodcramer:masterfrom
llbbl wants to merge 1 commit intodcramer:masterfrom
Conversation
- Migrate from requirements.txt to Poetry package management - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with coverage reporting (80% threshold) - Create test directory structure (unit/integration) - Add shared fixtures in conftest.py - Update .gitignore with testing artifacts - Add validation tests to verify 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 MangoDB server project using modern Python development tools and best practices.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetry dependenciesTesting Framework
pytest- Main testing frameworkpytest-cov- Coverage reporting with 80% thresholdpytest-mock- Mocking utilities for unit testsProject Structure
Configuration
pytest configuration in
pyproject.toml:unit,integration,slowCoverage configuration:
server.pyhtmlcov/), XML (coverage.xml)Shared Fixtures (
conftest.py)temp_dir- Temporary directory managementtemp_file- Temporary file handlingmock_socket- Socket mocking for network testsmock_environ- Environment variable mockingmock_gevent_server- Gevent server mockingmock_file_operations- File I/O mockingmock_threading- Threading component mockingreset_modules- Module state reset between testsclient_socket_data- Sample socket communication dataserver_config- Test server configurationAdditional Files
.gitignore: Added testing artifacts, build files, IDE files, and.claude/*run_tests.sh: Helper script for running testsHow to Use
Install dependencies
Run all tests
poetry run pytest # or ./run_tests.shRun specific test types
Run with coverage
Run validation tests
Notes
tests/unit/test_server_basic.pyto demonstrate usageNext Steps
Developers can now immediately start writing tests for the MangoDB server functionality using the established infrastructure and shared fixtures.