feat: Add complete Python testing infrastructure with Poetry and pytest#83
Open
llbbl wants to merge 1 commit into
Open
feat: Add complete Python testing infrastructure with Poetry and pytest#83llbbl wants to merge 1 commit into
llbbl wants to merge 1 commit into
Conversation
- Set up Poetry as package manager with pyproject.toml configuration - Migrate dependencies from requirements.txt to Poetry - Add testing dependencies: pytest, pytest-cov, pytest-mock, pytest-django - Configure pytest with coverage reporting (80% threshold) - Create comprehensive test directory structure - Add shared fixtures in conftest.py for common testing patterns - Update .gitignore with testing and Poetry-related entries - Create 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.
Add Python Testing Infrastructure
Summary
This PR sets up a complete testing infrastructure for the Django project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and running tests with comprehensive coverage reporting.
Changes Made
Package Management
pyproject.tomlwith complete Poetry configurationrequirements.txtto Poetrypoetry.lockfor reproducible buildsTesting Framework
Project Structure
Configuration Features
unit,integration, andslowmarkers for test categorizationpoetry run testandpoetry run testscommands availableShared Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir: Temporary directory managementmock_datetime: Consistent datetime mockingtest_user/admin_user: User creation utilitiesauthenticated_client/admin_client: Pre-authenticated test clientssample_product_data: Test data generationmock_file: File operation mockingmock_external_api: External API mockingcapture_logs: Log capture for testingEnvironment Setup
.envfile with required Django settings for testing.gitignorewith comprehensive exclusions for testing artifactsHow to Use
Installation
Running Tests
Writing New Tests
test_*.pyor*_test.pytests/unit/and integration tests intests/integration/conftest.py@pytest.mark.unit,@pytest.mark.integration, or@pytest.mark.slowNotes
pyproject.tomlNext Steps