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

Fix(tests): restore config values after changing them in tests #2904

Merged
merged 1 commit into from
Apr 22, 2023

Conversation

Torantulino
Copy link
Member

@Torantulino Torantulino commented Apr 22, 2023

Background

Config values are currently being changed during testing, which effects later tests in the queue.

Example error this can cause:
openai.error.InvalidRequestError: The model gpt-3.5-turbo-test does not exist

Changes

This PR ensures all values changed during testing are reset after the test.

Documentation

All code commented.

Test Plan

Tests are still passing on this file.

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

@Torantulino Torantulino mentioned this pull request Apr 22, 2023
5 tasks
@codecov
Copy link

codecov bot commented Apr 22, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.08 ⚠️

Comparison is base (0efbe23) 36.29% compared to head (47e5f15) 36.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2904      +/-   ##
==========================================
- Coverage   36.29%   36.22%   -0.08%     
==========================================
  Files          60       60              
  Lines        2849     2849              
  Branches      471      471              
==========================================
- Hits         1034     1032       -2     
- Misses       1753     1755       +2     
  Partials       62       62              

see 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +119 to +126
# Store debug mode to reset it after the test
debug_mode = self.config.debug_mode

self.config.set_debug_mode(True)
self.assertTrue(self.config.debug_mode)

# Reset debug mode
self.config.set_debug_mode(debug_mode)
Copy link
Member

Choose a reason for hiding this comment

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

This seems to reduce coverage for some debug statements in json_fix_general, suggesting tests aren't run in debug mode. Should they be?

Copy link
Member Author

@Torantulino Torantulino Apr 22, 2023

Choose a reason for hiding this comment

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

Weird.
That's definitely something to look into then, especially as this flag was being set half way through the set of tests.
@ntindle

Copy link
Member

Choose a reason for hiding this comment

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

IMO would should have each test able to specify a config and a reasonable set of Params as defaults. Test plans for this should be considered a priority

@Pwuts Pwuts changed the title Resets all config values that are changed during testing. Fix(tests): restore config values after changing them in tests Apr 22, 2023
@Pwuts Pwuts merged commit e39cd1b into master Apr 22, 2023
@Pwuts Pwuts deleted the reset-test-config branch April 22, 2023 10:14
@Pwuts Pwuts added the testing label Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants