Expand unit test coverage and add CI workflow for automated testing#41
Merged
dmccoystephenson merged 3 commits intomainfrom Feb 1, 2026
Merged
Expand unit test coverage and add CI workflow for automated testing#41dmccoystephenson merged 3 commits intomainfrom
dmccoystephenson merged 3 commits intomainfrom
Conversation
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Expand unit tests for existing code
Expand unit test coverage for JSON I/O, Prompt, and Tavern modules
Oct 13, 2025
Member
|
@copilot add CI checks to verify unit tests pass |
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Expand unit test coverage for JSON I/O, Prompt, and Tavern modules
Expand unit test coverage and add CI workflow for automated testing
Feb 1, 2026
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.
Overview
This PR significantly expands the unit test coverage for the FishE project, adding 12 new test functions across 5 test files, and implements a GitHub Actions CI workflow to automatically verify tests pass on every push and pull request. The changes focus on previously untested or under-tested modules, particularly file I/O operations and edge cases.
Changes Made
New Test File
tests/prompt/test_prompt.py- Created comprehensive tests for thePromptclass, which previously had no test coverageEnhanced Test Coverage
JSON Reader/Writer Classes
Added file I/O tests for all three JSON reader/writer classes:
playerJsonReaderWriter.py- Addedtest_writePlayerToFileandtest_readPlayerFromFileto verify serialization/deserializationstatsJsonReaderWriter.py- Addedtest_writeStatsToFileandtest_readStatsFromFileto verify stats persistencetimeServiceJsonReaderWriter.py- Addedtest_writeTimeServiceToFileandtest_readTimeServiceFromFileto verify time tracking persistenceThese tests use temporary files to ensure file I/O operations work correctly and handle data round-trips properly.
Tavern Gambling Logic
Enhanced tavern tests with additional edge case coverage:
test_gamble_loss- Tests the gambling loss scenario and stat trackingtest_changeBet_insufficient_money- Tests error handling when player bets more than they havetest_changeBet_invalid_input- Tests handling of non-numeric inputtest_getDrunk_updates_stats- Verifies stat updates when getting drunkCI/CD Integration
.github/workflows/test.yml- Added GitHub Actions workflow that automatically runs all unit tests on push and pull requests tomainanddevelopbranchesREADME.md- Added status badge to display current test statusCoverage Improvements
playerJsonReaderWriter.py: 80% → 100% ✅statsJsonReaderWriter.py: 80% → 100% ✅timeServiceJsonReaderWriter.py: 75% → 100% ✅prompt.py: 0% → 100% ✅tavern.py: 65% → 70% (+5%)Testing
All 78 tests pass successfully:
$ python3 -m pytest --cov=src --cov-report=term 78 passed in 0.73s TOTAL coverage: 87%The CI workflow is configured to run these tests automatically on every push and pull request, ensuring continuous verification of code quality.
Notes
All new tests follow the existing test patterns in the repository (prepare/call/check structure) and use appropriate mocking to avoid side effects. The tests are focused on validating core functionality and edge cases without modifying any production code.
Original prompt
Fixes #40
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.