feat: Use Gemini to set-up the basics of tests for our python cli#277
feat: Use Gemini to set-up the basics of tests for our python cli#277justinbarclay merged 22 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a test suite for the Python CLI machine stats project, utilizing pytest as the testing framework. The changes include setting up basic test infrastructure and adding initial test coverage for core functionality.
- Adds pytest and pytest-mock to development dependencies across multiple package management systems (Pipfile, dev-requirements.txt, flake.nix)
- Creates test files covering process statistics, CPU utilization, and helper functions
- Sets up a GitHub Actions workflow to run tests on pull requests against Python 3.8, 3.9, and 3.10
- Bumps the version from "develop" to "0.1.1"
Reviewed Changes
Copilot reviewed 9 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| unix/tests/test_proc_stats.py | Adds unit tests for parse_status and process_stats functions with comprehensive mocking |
| unix/tests/test_main.py | Creates tests for RAM, storage, CPU, and IP address helper functions |
| unix/tests/test_helpers.py | Duplicates helper function tests with slightly different test cases |
| unix/tests/test_cpu_utilization.py | Adds tests for CPU utilization measurement functions |
| unix/setup.py | Updates package version from "develop" to "0.1.1" |
| unix/flake.nix | Adds pytest and pluggy to Nix development environment |
| unix/dev-requirements.txt | Adds pytest and pytest-mock dependencies |
| unix/Pipfile | Adds pytest and pytest-mock to pipenv configuration |
| .github/workflows/python-tests.yml | Creates GitHub Actions workflow for automated testing on PRs |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
…rror Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This makes it easier to follow the logic and does not rely on a second if check for the same condition
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
0c5fbc8 to
077d265
Compare
6d5b79e to
6197cf4
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 17 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9768723 to
fa0fb85
Compare
SamDesmondKing
left a comment
There was a problem hiding this comment.
Awesome improvements and refactors here, this repo was long overdue for some love.
|
@SamDesmondKing this should be fixed |
* feat: use gemini to write tests for python modules * chore: add test workflow * chore: update contributing on running tests * test: add test for cli * test: add comprehensive tests for proc_stats module * chore: Add debug prints and refine proc stats test * refactor: Extract helper functions from parse_status * refactor: tests to handle new structure in proc_stats * chore: update gitignore pyc * fix: Refactor proc_stats module control flow to prevent UnboundLocalError * chore: fix potential divide by zero bug * tests: enhance and expand the test coverage * chore: fix bug where a timeout of 1 results in only running once * clarify and add tests * fix: bug where module.exit_json doesn't return * fix: assign result after after successful calculation. This makes it easier to follow the logic and does not rely on a second if check for the same condition * test: Add test_main to verify main function setup with mocks * fix: Correctly mock open context manager and assert call in test_main * fix: workflow triggers * chore: fix lints * remove: pointless cli tests * chore: fix python flake integration

No description provided.