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 #24

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

fix tests #24

wants to merge 5 commits into from

Conversation

jeromehardaway
Copy link
Collaborator

@jeromehardaway jeromehardaway commented Nov 22, 2024

This PR is to fix the tests by mocking the OPENAI_API_KEY environment variable in the VetsAI project.

@Sfayson1
Copy link

How do the mock objects (MagicMock) help us in this test?

@jonulak
Copy link
Contributor

jonulak commented Nov 22, 2024

Where does the mock_file fixture come from?

@jeromehardaway
Copy link
Collaborator Author

How do the mock objects (MagicMock) help us in this test?

Mock objects, specifically MagicMock in Python's unittest.mock library, are crucial for unit testing. It helps isolate while preventing actual API calls.

@jeromehardaway
Copy link
Collaborator Author

Where does the mock_file fixture come from?

The mock_file is actually created by the @patch decorator, not a fixture. It patches Python's built-in open function so we can test file operations without touching the real file system. The mock gets injected automatically as a parameter to our test function - super useful for testing file handling without worrying about actual files! 👨‍💻

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