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(test): fixing tests for when PANDABI_API_KEY is present in .env #1527

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

scaliseraoul
Copy link
Contributor

@scaliseraoul scaliseraoul commented Jan 17, 2025


Important

Patch environment to empty dictionary in tests to prevent PANDABI_API_KEY from affecting test outcomes.

  • Tests:
    • Add @patch("pandasai.os.environ", {}) to test_session_init_without_api_key, test_session_init_with_none_api_key, test_session_init_with_api_key, test_session_init_with_default_api_url, test_session_init_with_custom_api_url, test_get_pandaai_session_without_credentials in test_session.py.
    • Add @patch("pandasai.os.environ", {}) to test_load_without_api_credentials in test_pandasai_init.py.

This description was created by Ellipsis for 405eba1. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 405eba1 in 27 seconds

More details
  • Looked at 66 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. tests/unit_tests/helpers/test_session.py:11
  • Draft comment:
    Consider using @patch.dict instead of @patch("pandasai.os.environ", {}) for consistency and clarity. This applies to other similar instances in this file.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of @patch("pandasai.os.environ", {}) is consistent across multiple test functions to ensure a clean environment for testing. However, the patching of os.environ should be done using @patch.dict for consistency and clarity, especially when other tests use @patch.dict. This will also ensure that the environment is restored after the test.
2. tests/unit_tests/test_pandasai_init.py:193
  • Draft comment:
    Consider using @patch.dict instead of @patch("pandasai.os.environ", {}) for consistency and clarity. This applies to other similar instances in this file.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of @patch("pandasai.os.environ", {}) is consistent across multiple test functions to ensure a clean environment for testing. However, the patching of os.environ should be done using @patch.dict for consistency and clarity, especially when other tests use @patch.dict. This will also ensure that the environment is restored after the test.

Workflow ID: wflow_revdW2yk30uHPpys


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 17, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 38.09524% with 13 lines in your changes missing coverage. Please review.

Project coverage is 76.80%. Comparing base (63e8c26) to head (b032812).
Report is 131 commits behind head on release/v3.

Files with missing lines Patch % Lines
pandasai/agent/base.py 31.57% 13 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           release/v3    #1527      +/-   ##
==============================================
- Coverage       79.09%   76.80%   -2.30%     
==============================================
  Files             149       58      -91     
  Lines            6013     1888    -4125     
==============================================
- Hits             4756     1450    -3306     
+ Misses           1257      438     -819     
Flag Coverage Δ
unittests 76.80% <38.09%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gventuri gventuri merged commit 2d54457 into sinaptik-ai:release/v3 Jan 17, 2025
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants