Conversation
* Update dependencies * Fix coverage by migrating to Typer's built in CliRunner
Summary of ChangesHello @Onyx-Nostalgia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on updating development dependencies and tools, specifically upgrading the Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request includes a number of valuable updates and refactorings, such as updating dependencies, improving documentation generation, and modernizing the CLI tests. The changes are well-executed and enhance the project's maintainability. I have one suggestion to further improve the test coverage for the command-line interface.
| def test_main() -> None: | ||
| """Test the main function of the CLI.""" | ||
|
|
||
| # Run the CLI command | ||
| result = subprocess.run( | ||
| [sys.executable, "-m", "fact.cli", "5"], | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
|
|
||
| # Check the output | ||
| assert result.returncode == 0 | ||
| assert "fact(5) = 120" in result.stdout | ||
| runner = CliRunner() | ||
| result = runner.invoke(app, ["5"]) | ||
| assert result.exit_code == 0 | ||
| assert "fact(5) = 120" in result.output |
There was a problem hiding this comment.
The test for the CLI is much improved by using CliRunner. However, it currently only covers a single happy path scenario. To make the tests more robust, I'd recommend parameterizing the test to cover edge cases and invalid inputs.
For example, you could test:
- The factorial of 0 (
fact(0) = 1). - Invalid input, such as a negative number, which should be handled by Typer's validation (
min=0) and result in a non-zero exit code.
Here's a suggestion using pytest.mark.parametrize. You'll also need to add import pytest at the top of the file.
| def test_main() -> None: | |
| """Test the main function of the CLI.""" | |
| # Run the CLI command | |
| result = subprocess.run( | |
| [sys.executable, "-m", "fact.cli", "5"], | |
| capture_output=True, | |
| text=True, | |
| ) | |
| # Check the output | |
| assert result.returncode == 0 | |
| assert "fact(5) = 120" in result.stdout | |
| runner = CliRunner() | |
| result = runner.invoke(app, ["5"]) | |
| assert result.exit_code == 0 | |
| assert "fact(5) = 120" in result.output | |
| @pytest.mark.parametrize( | |
| ("args", "expected_output", "expected_exit_code"), | |
| [ | |
| (["5"], "fact(5) = 120\n", 0), | |
| (["0"], "fact(0) = 1\n", 0), | |
| # Typer exits with 2 for validation errors. | |
| (["-1"], "Invalid value for 'N'", 2), | |
| ], | |
| ) | |
| def test_main(args: list[str], expected_output: str, expected_exit_code: int) -> None: | |
| """Test the main function of the CLI with various inputs.""" | |
| runner = CliRunner() | |
| result = runner.invoke(app, args) | |
| assert result.exit_code == expected_exit_code | |
| assert expected_output in result.output |
…310) * Add Python 3.14 support and update default to 3.13 Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com> * Update Dockerfile to Python 3.13 and drop Python 3.9 support Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com>
* Update Dockerfile to use Debian trixie container images Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com>
* Initial plan * Update GitHub Actions to latest major versions - Bump actions/checkout from v4 to v5 - Bump astral-sh/setup-uv from v5 to v7 - Bump actions/setup-python from v5 to v6 - Keep docker/build-push-action at v6 (already latest major) Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: johnthagen <10340167+johnthagen@users.noreply.github.com>
* Update dependencies * Update license report
|




No description provided.