Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: simplify test cases to reduce calls to gpt #69

Merged
merged 19 commits into from
May 9, 2023

Conversation

dciborow
Copy link
Collaborator

@dciborow dciborow commented May 9, 2023

Description

Testing

Additional context

dciborow added 17 commits May 8, 2023 18:46
reduce test cases without reducing coverage
## Description

<!-- Prefix the PR title with 'feat:' to increment the minor version, or
'fix:' to increment the patch version -->

<!-- Describe what changes this PR introduces and their effects -->
<!-- Update documentation if there are any changes to existing features
or APIs -->

## Testing

<!-- Describe how you tested your changes and how reviewers can test
them -->
<!-- Ensure all code can be tested offline (unmarked tests) and online
(marked as 'integration') -->

## Additional context

<!-- Add any other context about your changes here -->

<!-- ## Breaking Changes -->

<!-- List any breaking changes introduced by this PR and their
implications and include '!' in the prefix. -->
## Description

<!-- Prefix the PR title with 'feat:' to increment the minor version, or
'fix:' to increment the patch version -->

<!-- Describe what changes this PR introduces and their effects -->
<!-- Update documentation if there are any changes to existing features
or APIs -->

## Testing

<!-- Describe how you tested your changes and how reviewers can test
them -->
<!-- Ensure all code can be tested offline (unmarked tests) and online
(marked as 'integration') -->

## Additional context

<!-- Add any other context about your changes here -->

<!-- ## Breaking Changes -->

<!-- List any breaking changes introduced by this PR and their
implications and include '!' in the prefix. -->
@dciborow dciborow changed the title Dciborow/reduce test cases test: simplify test cases to reduce calls to gpt May 9, 2023
@dciborow dciborow requested a review from danay1999 May 9, 2023 21:58
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary by GPT-4

This commit makes several changes to the test suite for the GPT CLI:

  1. It refactors the test cases into data classes, making it easier to manage and understand the different test cases.
  2. It adds new test cases for different CLI options and error scenarios.
  3. It updates some of the existing test cases to use more descriptive variable names and improve readability.
  4. It adds new tests for running the CLI as a module, ensuring that it works correctly when invoked in this way.

Overall, these changes should make the test suite more robust and easier to maintain in the future.

Suggestions

Here are some suggestions for improving the changes in this PR:

  1. In .github/workflows/python.yml, update the actions/setup-python version to the latest one (currently v3) instead of v4, which does not exist yet.
-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v3
  1. In tests/conftest.py, add a docstring to the mock_query function for better readability.
def mock_query(self, question) -> MockQueryResponse:
    """
    Mock query function for testing purposes.
    """
    return MockQueryResponse()
  1. In tests/test_gpt_cli.py, consider adding comments to each group of test cases (e.g., ROOT_COMMANDS, ASK_COMMANDS, etc.) to provide a brief explanation of what they are testing.

Other than these minor suggestions, the changes in this PR look good and well-organized.

src/gpt_review/_openai.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented May 9, 2023

Codecov Report

Merging #69 (53f5ca6) into main (b8cc6ff) will increase coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 53f5ca6 differs from pull request most recent head 1a2cd54. Consider uploading reports for the commit 1a2cd54 to get more accurate results

@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
+ Coverage   89.14%   89.17%   +0.02%     
==========================================
  Files          14       14              
  Lines         433      434       +1     
  Branches       65       65              
==========================================
+ Hits          386      387       +1     
  Misses         34       34              
  Partials       13       13              
Flag Coverage Δ
integration 85.71% <ø> (+0.03%) ⬆️
unittests 86.40% <ø> (+0.03%) ⬆️
unittests-3.10 86.40% <ø> (+0.03%) ⬆️
unittests-3.11 86.40% <ø> (+0.03%) ⬆️
unittests-3.8 86.40% <ø> (+0.03%) ⬆️
unittests-3.9 86.40% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/gpt_review/_openai.py 100.00% <ø> (ø)

@danay1999 danay1999 merged commit f6debbe into microsoft:main May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants